INtime SDK Help

Deallocates a memory block.

Note:   malloc allocates physical memory to the current process's Vseg as required. free never physically releases memory allocated by malloc.

For alternative memory management methods, see heap object management.

#include <stdlib.h>
#include <malloc.h>

void free (void *memblock);

void _free_internal (void *memblock);


Points to a memory block previously allocated through a call to calloc, malloc, or realloc.


The number of bytes freed is the number of bytes specified when the block was allocated, or reallocated, in the case of realloc. After the call, the freed block is available for allocation.

_free_internal behaves identically to free, use it to implement your own debug version of free.

Calling free() on an invalid pointer is a run-time error. The error is reported to the user via the signal interface. To install your own SIGFREE handler:

#include <signal.h>
void mysigfree(int signal) {
printf(“mysigfree: %d\n”, signal);
signal(SIGFREE, mysigfree); 

To ignore the SIGFREE signal:

signal(SIGFREE, SIG_IGN); 

You may write your own free stub which validates the pointer and optionally reports the error.

void free(void *p) {
if (heap_validate_buffer(p) == -1)
// do something ;

Return Values



Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdlib.h stdlib.h
See Also