The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


free - free allocated memory


#include <stdlib.h>

void free(void *ptr);


The free() function causes the space pointed to by ptr to be deallocated; that is, made available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if the argument does not match a pointer earlier returned by the calloc(), malloc(), realloc() or valloc() function, or if the space is deallocated by a call to free() or realloc(), the behaviour is undefined.

Any use of a pointer that refers to freed space causes undefined behaviour.


The free() function returns no value.


No errors are defined.




There is now no requirement for the implementation to support the inclusion of <malloc.h>.




calloc(), malloc(), realloc(), <stdlib.h>.


Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]