Admin관리자   |    Posting포스트   |    LogOut로그아웃
:+:하늘을닮은호수:+: | Trac | 블로그   |    위치로그   |    태그로그   |    방명록


:+:하늘을 닮은 호수:+:
http://sunsson.iptime.org
Category
전체 (944)
[Standard] (58)
[OS] (116)
[Develope] (74)
[IT Trend] (347)
[Music] (93)
[삶의 질] (255)
Tag List
trac   3GPP   IPTV   svn   2MB   c99   PSS   RTP   VoIP   H.263   네 멋대로 해라   양동근   이나영   손예진   memory_leak   팔봉산   FLV   ffmpeg   cdn   grep   이명박   aio   beryl   awk   iLBC   강태우   gnuplot   avc   AutoConf   끝이아니길  
«   2008/08   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
LeakTracer - trace and analyze memory leaks in C++ programs
Date : 2007/10/11 15:22

LeakTracer - trace and analyze memory leaks in C++ programs

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.

Availability

LeakTracer 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.

What's new
Nov 16A few user contributions to LeakTracer
Sep 19The wonderful world of CSS
Feb 13New XEmacs elisp -- C/C++ utilities

Site navigation


External links for this page
ccmalloc - Shows full function traceback
valgrind - powerful tool combines strace/efence/leak tracing

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) {}

Allocations: 1 / Size: 80x8055b02 is in init_types(void) (Type.cc:119).118 void init_types() {119 Type::Integer = new IntegerType;

Allocations: 1 / Size: 132 (new[])0x805f4ab is in Hashtable::Hashtable(unsigned int) (ea/h/Hashtable.h:15).14 Hashtable (uint _size = 32) : size(_size), count(0) {15 table = new List [size];

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기
2007/10/11 15:22 2007/10/11 15:22

블로그코리아에 블UP하기
Top
Creative Commons License
블로그 내에 모든 저작물은 크리에이티브 커먼즈코리아 저작자표시 - 비영리 - 변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
website stats 믹시 블로그코리아에 블UP하기

Google

블로그 검색
최근 덧글
펼치기
최근 트랙백
펼치기
Today :
136
Yesterday :
198
Total :
62474
Powered by :
Textcube
ver :
1.6.3 : Tenuto
skin by :