Memory leaks in compiler

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Wed Jan 16 21:55:00 GMT 2008


From: "Tom Tromey" <tromey@redhat.com>

>>>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> A valgrind suppression only silences the error for valgrind.  What 
> if
> Kaveh> someone uses another memory checking tool?  Better to fix it for 
> real
> Kaveh> IMHO.
>
> Add suppressions for all of them.  Any decent memory checker has to
> account for the reality that many programs don't bother freeing memory
> before exit.

That a maintenance headache.  Why fix problems in multiple places (checking 
tools) when you can fix it once and for all in a single place?  Otherwise 
some guy using another tool has to scratch his head, spend time and wonder 
is this a real bug or not?  I'd rather not waste time for the next volunteer 
who uses a different tool.

> Or, to put it another way, why add this free and not, say, something
> to free all the other memory allocated by gcc which is live at exit?
> I think there are a lot of instances of this.
> Tom

I would free them all if they are easy to do.  I.e. sometimes you don't have 
a clear handle on the memory at the point you know it's ready to be free'd 
or you're exitting.  However this one is simple.

        --Kaveh
--
Kaveh R. Ghazi



More information about the Gcc mailing list