On Saturday 30 November 2002 11:40 pm, Dale Kingston wrote:
> Hey I was wondering if anyone knows a good tool for finding mem leaks? I've
> hurd of electric fence, but I don't know much about it. And if it works with
> C++. So if anyone knows anything about a good tool for that. Or if anyone
> knows about electric fence let me know. Thanks in advance.
> 
> 
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> 

For C++ code, it might be worth taking a look at LeakTracer, by (surprise!) 
Erwin Andreasen. From the website:

--<quote>---
LeakTracer is a small tool I wrote when checking a C++ program for memory 
leaks. I couldn't get dmalloc to display what I wanted, and I just saw the 
__builtin_return_address gcc-extension mentioned.

To use LeakTracer, run your program using the provided LeakCheck script. It 
uses the LD_PRELOAD feature to "overlay" some functions on top of your 
functions (no recompile needed). If your platform does not support 
LD_PRELOAD, you can add the LeakTracer.o object file to the objects in your 
Makefile and run your application.

LeakTracer uses gdb to print out the exact line where the memory was allocated 
and not freed - this of course means you have to free all dynamically 
allocated data. LeakTracer also overrides the global operator new and 
operator delete - this will give problems if you override them as well.

LeakTracer traces only new/new[] and delete calls - it does not look at 
malloc/free/realloc.

Read the full README file included in the package for more information. 
--<end quote>---

http://www.andreasen.org/LeakTracer/

-- 
Bobby Bailey    | "The only source of knowledge is experience."
MUD Developer   | -- Albert Einstein
Internet Junkie | PGP Keys: http://chil.kyndig.com/pgp
http://www.kyndig.com/ -- Mud & Online Text Game Community


Reply via email to