[comp.sys.ibm.pc] Microsoft C - Heap space questi

mcdonald@uxe.cso.uiuc.edu (09/28/89)

When a DOS program starts up, it takes all available memory (this
just means that DOS itself makrs it as unusable for anything else.)
But most C runtime systems 'give back to DOS all that is not needed
by the program being run, before the "main" gets called.
Malloc (at least farmalloc) gets some of that back from DOS.
But the runtime will give it back when the program ends.

Even if you stop the program with a direct call to the DOS
"end program" routine, rather than use the C runtime exit(),
it appears to give it back. This last statement is based on
test programs rather than documentation.

The only way to keep memory for a program after exit is to call
the TSR terminate routine.

Doug McDonald