On Thu, Jan 17, 2008 at 11:08:25AM -0500, Ross Ridge wrote: > Diego Novillo wrote: > >I agree. Freeing memory right before we exit is a waste of time. > > Dave Korn writes: > > So, no gcc without an MMU and virtual memory platform ever again? > >Shame, it used to run on Amigas. > > I don't know if GCC ever freed all of its memory before exiting. > An operating system doesn't need an MMU or virtual memory in order to > free all the memory used by a process when it exits. MS-DOS did this, > and I assume AmigaOS did as well.
No, AmigaOS did not free memory used by a process when it exits. AmigaOS did not keep track of which memory belonged to which process. For programs that exited normally (e.g. through exit() or a return from main()) then the C library freed all memory that had been allocated through malloc/calloc/realloc (together with closing open files and calling functions registered through atexit(), etc.). A program that crashed and thus did not call these cleanup routines caused a memory leak. -- <Insert your favourite quote here.> Erik Trulsson [EMAIL PROTECTED]