There's a tool called Electric Fence, look it up on Freshmeat.  Basically it's
a library that you link with, no changes to the code, that tracks all your
malloc and free calls.  You then run your program inside gdb and Electric
Fence causes your code to cause a fault that you can trap with gdb and find
the line.  It's not as nice or as fully featured as Purity, but it does work
nciely and it's free.

"Mike Bresnahan" <mbresnah at visi.com> writes:

> Does anyone know of an equivalent of Rational Purify for GCC/Linux?  Purify
> is a wonderful debugging tool for C/C++ that detects bugs such as freeing
> memory twice, reading/writing past the end of an array, leaking memory, etc.
> It accomplishes this by editing object code; inserting debugging
> instructions directly into the .o's.  Last I was doing GCC/Linux development
> several years ago, no such beast existed, but a lot has changed since then.
> The best there was back then consisted of various drop in replacements for
> malloc/free and other C library functions.  The fatal flaws with these tools
> is that none of them produce full stack traces automatically and they
> require a recompilation of the source code.  The problem with Purify is that
> very few compiler/platform combinations are supported and GCC/Linux is not
> one of them.
> 
> Mike
> 
> 
> _______________________________________________
> tclug-devel mailing list
> tclug-devel at mn-linux.org
> https://mailman.mn-linux.org/mailman/listinfo/tclug-devel

-- 
Jon Schewe | http://mtu.net/~jpschewe | jpschewe at mtu.net
For I am convinced that neither death nor life, neither angels 
nor demons, neither the present nor the future, nor any 
powers, neither height nor depth, nor anything else in all 
creation, will be able to separate us from the love of God that 
is in Christ Jesus our Lord. - Romans 8:38-39