.TH free() "" "" "General Function (libc)"
.PC "Return dynamic memory to free memory pool"
.B "#include <stdlib.h>"
\fBvoid free(\fIptr\^\fB) char *\fIptr\^\fB;\fR
.PP
.B free()
helps you manage the arena.
It returns to the free memory pool
memory that had previously been allocated by
.BR malloc() ,
.BR calloc() ,
or
.BR realloc() .
.B free()
marks the block indicated by \fIptr\fR as unused, so the
.B malloc()
search can coalesce it with contiguous free blocks.
.I ptr
must have been obtained from
.BR malloc() ,
.BR calloc() ,
or
.BR realloc() .
.SH Example
For an example of how to use
this routine, see the entry for
.BR malloc() .
.SH "See Also"
.Xr "libc" libc
.br
\*(AS, \(sc7.10.3.2
.br
\*(PX Standard, \(sc8.1
.SH Diagnostics
.B free()
prints a message and calls \fBabort()\fR if it discovers that the
arena has been corrupted.
This most often occurs
by storing data beyond the bounds of an allocated block.
