Microsoft C - Heap space question

Scott Amspoker scott at bbxsda.UUCP
Sat Sep 30 01:40:15 AEST 1989


In article <2522052c at ralf> Ralf.Brown at B.GP.CS.CMU.EDU writes:
>In article <14792 at netnews.upenn.edu>, catone at dsl.cis.upenn.edu (Tony Catone) wrote:
>.EXEs get the amount of memory requested in their header info, which is
>usually specified as FFFFh paragraphs (all available memory), but can be
>changed by a utility such as EXEMOD.

It is considered good programming practice under DOS to return unneeded
memory to the system when your program starts up.  .COMs typically get
all of memory for historical reasons.  Such programs frequently just assume
they have all of memory.  .EXEs are smarter but, as Tony Catone says,
usually get all of memory anyway.

>At least the Turbo C startup code (before main() is reached) adjusts the
>program's memory block to use only the required memory, even though it
>might initially have been given all of memory.

This is true.  I use Turbo C myself.  I would hope that Microsoft C
also did this since the system() library call wouldn't work.  To 
require the programmer to explicity deallocate memory at startup
would not be consistent with the "spirit of C".

-- 
Scott Amspoker
Basis International, Albuquerque, NM
(505) 345-5232



More information about the Comp.lang.c mailing list