ID Number: Q31811
4.x 5.x
MS-DOS
Summary:
During program start-up in the Microsoft C Compiler, any memory
beyond the 64K limit of the default data segment is released to
MS-DOS. (The amount returned can be increased by using the
/CPARMAXALLOC switch to the LINK, or the EXEMOD utility.) This
procedure allows C programs to exec child programs.
More Information:
The first call to the near-heap allocation routine, _nmalloc,
creates the near heap, which can use the remaining free space in the
default data segment. The first call to the far-heap allocation
routine, _fmalloc, creates the first far-heap segment by requesting a
block of memory from DOS rounded up to the nearest 8K (power of 2
equal to or greater than the global variable _amblksiz).
Subsequent _fmalloc calls will expand the last far-heap segment up
to 64K before allocating another far-heap segment. When all far memory
has been used, _fmalloc will try to allocate the memory from the near
heap.