_sfree()

Updated: April 19, 2023

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.

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.