51

I have a .exe and many plug-in .dll modules that the .exe loads. (I have source for both.) A cross-platform (with source) solution would be ideal, but the platform can be narrowed to WinXP and Visual Studio (7.1/2003 in my case).

The built-in VS leak detector only gives the line where new/malloc was called from, but I have a wrapper for allocations, so a full symbolic stack trace would be best.

The detector would also be able to detect for a leak in both the .exe and its accompanying plug-in .dll modules.

Johan
  • 18,177
  • 25
  • 89
  • 107
Jim Buck
  • 19,506
  • 10
  • 50
  • 72
  • http://www.saunalahti.fi/~tarmpika/diagnostic/ I had tried so many memory leak detectors that it's difficult to count them all. Some of them crashed, some of them produced invalid results, some of them simply did not help. Managed / native / 32 & 64-bit architectures supported. This however is not free for time being. – TarmoPikaro Feb 09 '16 at 17:38
  • 1
    Published source code as well: https://sourceforge.net/projects/diagnostic/ – TarmoPikaro Sep 30 '16 at 13:35
  • 2
    Oh, nice! (By the way, I didn't realize this became off-topic....after 5.5 years! :) ) *shrug* This is still super-relevant to programming. Not sure where else this would go. – Jim Buck Sep 30 '16 at 17:16

7 Answers7

37

I personally use Visual Leak Detector, though it can cause large delays when large blocks are leaked (it displays the contents of the entire leaked block).

Dan Moulding
  • 183,296
  • 21
  • 89
  • 97
Zooba
  • 10,579
  • 2
  • 33
  • 39
  • Extremely useful and really simple tool! I like it. Thanks for the hint! – Knasterbax Jan 05 '13 at 20:32
  • Diagnostic - memory leak detection: https://sourceforge.net/projects/diagnostic/ Compared to Visual Leak Detector it does not require any integration to host project (unless you want to have memory leak detection as built-in into application) – TarmoPikaro Sep 22 '16 at 20:50
18

If you don't want to recompile (as Visual Leak Detector requires) I would recommend WinDbg, which is both powerful and fast (though it's not as easy to use as one could desire).

On the other hand, if you don't want to mess with WinDbg, you can take a look at UMDH, which is also developed by Microsoft and it's easier to learn.

Take a look at these links in order to learn more about WinDbg, memory leaks and memory management in general:

davidag
  • 2,505
  • 3
  • 23
  • 40
8

I have had good experiences with Rational Purify. I have also heard nice things about Valgrind

Anders Sandvig
  • 19,763
  • 16
  • 56
  • 71
3

As for me I use Deleaker to locate leaks. I am pleased.

Artem Razin
  • 1,124
  • 6
  • 19
MastAvalons
  • 1,140
  • 1
  • 13
  • 23
2

My freely available memory profiler MemPro allows you to compare 2 snapshots and gives stack traces for all of the allocations.

j0k
  • 21,914
  • 28
  • 75
  • 84
1

As several of my friend has posted there are many free leak detectors for C++. All of that will cause overhead when running your code, approximatly 20% slower. I preffer Visual Leak Detector for Visual C++ 2008/2010/2012 , you can download the source code from - enter link description here .

Idanuda
  • 11
  • 1
1

Try Jochen Kalmbach's Memory Leak Detector on Code Project. The URL to the latest version was somewhere in the comments when I last checked.

Agnel Kurian
  • 53,593
  • 39
  • 135
  • 210