[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

_sfree()

Deallocate a block of memory

Synopsis:

#include <malloc.h>

void _sfree( void *ptr,
             size_t size );

Arguments:

ptr
NULL, or a pointer to the block of memory that you want to free.
size
The number of bytes to deallocate.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.


Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

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.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

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.

See also:

calloc(), free(), realloc(), _scalloc(), _smalloc(), _srealloc()


[Previous] [Contents] [Index] [Next]