[vox-tech] Must one free() in C?

nbs vox-tech@lists.lugod.org
Wed, 8 May 2002 11:50:28 -0700


On Wed, May 08, 2002 at 11:34:00AM -0700, Mark K. Kim wrote:
<snip>
> If tmp1 is allocated (but not tmp2) at the time of exit(1), is it
> guaranteed to be freed by the exiting process?  Or does one must free tmp1
> before exitting?  The answer doesn't really matter on Linux (or most
> modern systems, I suppose)  since it frees memory nonetheless, but is that
> the standard?  The impliciation of requiring calls to free() before
> exitting is enormous -- one would have to keep track of all the allocated
> memory before exitting from any error condition!

Good question!  I hope (and am relatively sure; but it's just a feeling :^) )
that the death of a process (whether it be by "exit()" or a kill signal)
freed up all allocated memory on pretty much any system with a sense
of memory management.

You could, of course, simply say

  Minimum RAM requirements:  XYZ

  Running the application with less than XYZ free causes undefined results.


;)

I love undefined results. ;)

Like, maybe if you say "ls -5aTanR0olz" will format your hard disk. ;) [*]


-bill!
ME - This is a Luvisi-ism ;)  Well.. not the Satan part, but the format part