Microsoft C - Heap space question

Ralf.Brown at B.GP.CS.CMU.EDU Ralf.Brown at B.GP.CS.CMU.EDU
Thu Sep 28 21:49:00 AEST 1989


In article <14792 at netnews.upenn.edu>, catone at dsl.cis.upenn.edu (Tony Catone) wrote:
 >In article <4143 at csd4.csd.uwm.edu> chad at csd4.csd.uwm.edu (D. Chadwick Gibbons) writes:
 >>       One very important note about farmalloc: usually, it will grab memory
 >>that was not original assigned to the executable when it ran.  Therefore, upon
 >
 >Is this really true?  I thought that DOS automatically allocated all free
 >system memory (not expanded or extended) to the currently executing program.

.COM programs always get the largest available block of memory (which is
all free memory unless you've managed to fragment memory by doing
something like running a TSR while shelled out of another program).
.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.

 >Does using C make a difference in this behavior?

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.

--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=-=-=-=- Voice: (412) 268-3053 (school)
ARPA: ralf at cs.cmu.edu  BIT: ralf%cs.cmu.edu at CMUCCVMA  FIDO: Ralf Brown 1:129/46
FAX: available on request                      Disclaimer? I claimed something?
"All through human history, tyrannies have tried to enforce obedience by
 prohibiting disrespect for the symbols of their power.  The swastika is
 only one example of many in recent history."
-- American Bar Association task force on flag burning



More information about the Comp.lang.c mailing list