Updated: October 28, 2024 |
Deallocate a block of memory
#include <malloc.h> void _sfree( void *ptr, size_t size );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
When the value of the argument ptr is NULL, the _sfree() function does nothing; otherwise, the _sfree() function deallocates size bytes of memory located by the argument ptr, which was previously returned by a call to the appropriate version of _scalloc() or _smalloc(). After the call, the freed block is available for allocation.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
Calling _sfree() on a pointer already deallocated by a call to _sfree() could corrupt the memory allocator's data structures.
The size must match the size of the allocated block.