|This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.|
Deallocate a block of memory
#include <malloc.h> void _sfree( void *ptr, size_t size );
- NULL, or a pointer to the block of memory that you want to free.
- The number of bytes to deallocate.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
|This function is in libc.a, but not in libc.so (in order to save space).|
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.
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.