COHERENT manpages

This page displays the COHERENT manpage for free() [Return dynamic memory to free memory pool].

List of available manpages
Index


free() -- General Function (libc)

Return dynamic memory to free memory pool
#include <stdlib.h>
void free(ptr) char *ptr;

free() helps  you manage  the arena.   It returns to  the free  memory pool
memory  that  had  previously  been  allocated  by malloc(),  calloc(),  or
realloc().  free() marks  the  block indicated  by  ptr as  unused, so  the
malloc() search can coalesce it with contiguous free blocks.  ptr must have
been obtained from malloc(), calloc(), or realloc().

Example

For an example of how to use this routine, see the entry for malloc().

See Also

libc
ANSI Standard, §7.10.3.2
POSIX Standard, §8.1

Diagnostics

free() prints  a message and calls  abort() if it discovers  that the arena
has  been corrupted.   This most  often occurs by  storing data  beyond the
bounds of an allocated block.