Microsoft C - Heap space question

Tony Catone catone at dsl.cis.upenn.edu
Thu Sep 28 05:19:06 AEST 1989


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
>normal terminal exit (via exit) this memory _will not_ be returned to the
>operating system.  To avoid "Insufficent Memory" errors later down the road,
>be sure to explicitly free this allocated memory.  I believe farmalloc has a
>corresponding free function called farfree, but check for user's guide to be
>exact on it's usage.

Is this really true?  I thought that DOS automatically allocated all free
system memory (not expanded or extended) to the currently executing program.
At least this is the way it worked when I used the EXEC call from assembly
language in DOS's 2.1 and 3.1; before you could spawn a child process, you 
had to explicitly deallocate memory.  I also believe I just recently saw an
article in the MicroSoft Systems Journal that used this same technique.
Does using C make a difference in this behavior?

- Tony
  catone at dsl.cis.upenn.edu
  catone at wharton.upenn.edu



More information about the Comp.lang.c mailing list