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

vox-tech@lists.lugod.org vox-tech@lists.lugod.org
Wed, 8 May 2002 20:16:39 -0400


On Wed, May 08, 2002 at 11:34:00AM -0700, Mark K. Kim wrote:
> 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?

  It doesn't mater what language, it doesn't mater how the process exits.

  Any operating environment which requires a failing program to clean up 
after itself properly will not be stable.

  Operating systems should reclaim the resources used by processes when the 
processes exit.  (This includes memory.)

    Later,
      Mike

ps:
  If you think about it it's not upto the language in use to decide what
happens to the runtime resources of a program that has gone away.