This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Memory leaks in compiler
- From: Erik Trulsson <ertr1013 at student dot uu dot se>
- To: Ross Ridge <rridge at csclub dot uwaterloo dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 17 Jan 2008 17:30:22 +0100
- Subject: Re: Memory leaks in compiler
- References: <20080117160825.99DF873D66@caffeine.csclub.uwaterloo.ca>
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
ertr1013@student.uu.se