Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
free Functions
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Functions in the free family deallocate a memory block. The
<memblock> argument 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.
The <seg> argument specifies the based heap containing the memory
block to be freed by the _bfree function.
Attempting to free an invalid pointer may affect subsequent
allocation and cause errors. Pointers not allocated with the
appropriate call are invalid.
The following restrictions apply to use of the free, _ffree, and
_nfree functions:
Blocks allocated with Should be freed with
calloc, malloc, realloc free
_fcalloc, _fmalloc, _frealloc _ffree
_ncalloc, _nmalloc, _nrealloc _nfree
_bcalloc, _bmalloc, _brealloc _bfree
A NULL pointer argument is ignored.
In large data models (compact-, large-, and huge-model programs),
free maps to _ffree. In small data models (tiny-, small-, and
medium-model programs), free maps to _nfree.
The various free functions deallocate a memory block in the
segments shown below:
Function Data Segment
free Depends on data model of program
_bfree Based heap specified by the <seg> value
_ffree Far heap (outside default data segment)
_nfree Near heap (inside default data segment)
Return Value
None.
-♦-