COHERENT manpages

This page displays the COHERENT manpage for notmem() [Check whether memory is allocated].

List of available manpages
Index


notmem() -- General Function (libc)

Check whether memory is allocated
int notmem(ptr);
char *ptr;

notmem() checks if a memory block has been allocated by calloc(), malloc(),
or realloc(). ptr points to the block to be checked.

notmem() searches the arena for ptr.  It returns one if ptr is not a memory
block obtained from malloc(), calloc(), or realloc(), and zero if it is.

See Also

arena,
calloc(),
free(),
libc,
malloc(),
memok(),
realloc(),
setbuf()

Notes

The only valid use for notmem() is in debugging code, such as in the bodies
of calls to the macro assert(). We furthermore recommend that portable code
should  conditionalize use  of notmem()  so that the  code may  continue to
compile on systems that lack such a facility.