LeakTracer - trace and analyze memory leaks in C++ programsLeakTracer 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. AvailabilityLeakTracer source: ( 10K) v2.4 LeakTracer.tar.gz LeakTrace works on my Linux system and has been reported to work on Solaris as well as HP-UX. Because of its simplicity it has gained some surprising popularity and has seen use in e.g. KDE and Mozilla. License: Public Domain (do with it whatever you want). EXTENDED VERSION: Michael Gopshtein has completely rewritten LeakTracer to make it more efficient and flexible, monitor specific threads and display the ful stack trace. Download LeakTracer-mg.tar.gz. LeakTracer is now part of Debian (testing/unstable), just apt-get install leaktracer, courtesy of Yann Dirson. |
|
Version history
February 23, 1999 v1.1 - first public releaseNovember 19, 2000 v2.0 - Rewrite by Henner Zeller introduces LD_PRELOAD and much moreFebruary 27, 2001 v2.1 - Further update by Henner: optional thread safety, choose what should make LeakTracer abort(), better tracing of delete on non-new'ed pointersAugust 28, 2003 v2.4 - Improve MAGIC on platforms that don't allow unaligned access
If you have a page for your project where you describe how you successfully used LeakTracer, do not hesitate to email me.
User Contributions
Sadly, time constraints have not yet permitted me to integrate these into the main LT package:
Patch for capturing and presenting multiple stack levels by JosarGonzz: ( 12K) leaktracer.all.diff -- this includes many other features, see mail.txt.
TK front-end by Andrew Ogley: (2.7K) v2.2 LeakTool-1.1.tgz
Excel macro for presenting LT results by Amir Kirsh and Ido Zilbergled: ( 13K) OrganizeLeakTracerOutput.zip
ARM patch by Patrick: leaktracer-on-arm.diff
Patch for tracing malloc/free too by Greg Stewart: LeakTracer-mf.cc (save as LeakTracer.cc and add -ldl to libraries in Makefile)
Example output
~/p/arc# ea/LeakTracer/leak-analyze ./arcGathered 8 (8 unique) points of data.(gdb)Allocations: 1 / Size: 360x80608e6 is in NullArcableInstance::NullArcableInstance(void) (Machine.cc:40).39 public:40 NullArcableInstance() : ArcableInstance(new NullArcable) {} |
'[OS] > Embedded&Linux' 카테고리의 다른 글
리눅스에 스토리지 붙이기 - Fedora 7 - (0) | 2007.10.13 |
---|---|
VMwere 에 페도라 7 설치하기 -VMwere 설정 편- (0) | 2007.10.12 |
termios (0) | 2007.09.27 |
autoconf manual (3) | 2007.09.17 |
AutoConf, Automake, and Libtool - Table of Contents (0) | 2007.09.17 |