By Drake

2009-01-05 15:37:39 8 Comments

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a equally good program for Windows.


@thegreendroid 2012-09-24 00:32:15

Clang supports the Address Sanitizer plugin (-faddress-sanitizer option), which can pretty much detect most bugs that Valgrind can find (does not support detection of uninitialised memory reads and memory leaks yet though). See this page for a comparison against Valgrind and other similar tools. An official Windows port is currently in progress, see Windows ASan port.

I attempted to build it myself on Windows a couple of months ago and gave up, see my related question. Things may have changed for the better now if you want to give it another go.

@Calmarius 2012-06-05 09:17:48

I found this SF project today:

They are porting valgrind to Windows. Probably in several years we will have a reliable valgrind on windows.

@Jasper Bekkers 2009-10-01 09:45:17

In combination with Visual Studio I generally use Visual Leak Detector or simply _CrtDumpMemoryLeaks() which is a win32 api call. Both are nothing fancy but they get the job done.

@tgs_stdio 2009-08-30 13:16:23

For Visual C++, try Visual Leak Detector. When I used it, it detected a memory leak from a new call and returned the actual line in source code of the leak. The latest release can be found at

@the_mandrill 2010-05-28 16:27:43

Works well for me too

@Synetech 2010-08-25 00:18:02

It does not seem to work for me. I even tried creating a simple project that did basically nothing other than to allocated some memory and not free it. VLD did not detect it. :-|

@relaxxx 2011-04-07 16:46:52

@Synetech inc. I had the same problem in VS2010... Using the newest version of VLD solved my problem

@Alexey Alexandrov 2012-02-21 19:57:46

Try Intel's Inspector XE product which can help you detect both memory and threading issues:

@Ricky Lung 2011-07-21 03:33:00

You can take a look to the article Design and Implementation of an In-Game Memory Profiler in the book "Game Programming Gems 8".

It shows how to implement a low overhead semi-intrusive real-time memory profiler, source code provided in the CD-ROM.

enter image description here

@Lailin Chen 2011-07-05 09:13:11

As jakobengblom2 pointed out, valgrind has a suit of tools. Depending which one you are talking about there are different windows counter parts. I will only mention OSS or free tools here.

1. MemCheck:

Dr. Memory. It is a relatively new tool, works very well on Windows 7. My favorite feature is that it groups the same leaks' allocation stacks in the report.

I have also used UMDH( ) and found it quiet useful and easy to setup. It works from Win2000 to Win7.

AppVerifier is a must have swissknife for windows native code developers, its "memory" checker does similar job

2. Callgrind:

My favorite is verysleepy ( ) It is tiny but very useful and easy to use.

If you need more features, AMD CodeAnalystâ„¢ Performance Analyzer is free:

Windows Performance Analysis tools is free from Microsoft, not very easy to use but can get the job done if you are willing to spend the time. Download:

3. Massif:

Similar(not quite exact match) free tools on windows are:

VMMap from sysinternals :

!heap command in windbg :

4. Cachegrind:

Above mentioned Windows Performance Tools has certain level of L2 cache miss profiling capability but not quite as good and easy to use as Cachegrind.

5. DRD:

Haven't found anything free and as powerful on Windows yet, the only free tool for windows I can find that is slightly close is the "lock" checker in AppVerifier:

@John Smith 2011-12-08 19:08:25

LeakDiag, Deleaker, UMDH, App Verifier, DebugDiag...

@John Smith 2011-12-20 18:59:06

deleaker - the best of these utilities...

@alexr 2012-02-13 17:29:33

There's also gperftools (formerly Google PerfTools). It's not a valgrind replacement (what is really) but it has a new malloc, cpu profiler, heap profiler and checker. Worth a look as it's support on Linux and Windows (inc Mingw) and other unices.

@Ira Baxter 2011-04-06 10:56:02

We are just completing a Memory Safety checking tool for Windows, that handles GCC and Micrsoft Visual C (not C++ yet), and are looking for Beta testers.

EDIT June 12, 2011: Not Beta anymore, now production for GCC and Microsoft Visual Studio C.

@Wayne Ariola 2011-04-05 20:31:38

Parasoft Insure++ has always been reliable:

@adrian 2011-02-06 16:58:12

Just an idea, you could also implement a memory allocator and track all calls to malloc and free. However this might be too much for some projects.

@Crashworks 2011-11-29 08:59:45

That's how most games do it. But it's a huge undertaking and a lot of instrumentation.

@grigy 2009-10-01 09:04:56

How about the Purify?

@David Rodríguez - dribeas 2009-10-01 09:07:01

Not really free... but I guess you could find a test license for testing purposes.

@Boris Raznikov 2009-10-01 09:09:37

They don't have a free trial

@dwj 2011-02-04 22:15:35

Dead link as of 2011-02-04 for BoundsChecker.

@rogerdpack 2010-08-09 14:15:51

If you're not afraid of mingw, here are some links (some might work with MSVC)...

@zr. 2010-07-02 07:08:59

The Boost Test library can detect memory leaks.

@Alex Budovski 2010-04-19 11:38:00

LeakDiag, UMDH, App Verifier, DebugDiag, are all useful tools to improve robustness of code and find memory leaks.

@Stephen Kellett 2010-04-02 13:57:19

Another memory tool for your list: Memory Validator.

Not free, but nowhere near as expensive as Purify or Boundschecker.

@Ashley Davis 2010-03-15 10:36:48

The free tool DebugDiag will help find memory and handle leaks.

You don't need to augument your program for DebugDiag to work.

Although it is not the easiest or most intuitive program to use! Make sure you google for tutorials and instructions on how to use it.

@Agnel Kurian 2010-03-03 09:42:00

Does Jochen Kalmbach's Memory Leak Detector qualify?

PS: The URL to the latest version is buried somewhere in the article's comment thread.

@Dan Kegel 2010-01-31 19:41:39

Why not use Valgrind + Wine to debug your Windows app? See

(Chromium uses this to check the Windows version for memory errors; see and look at the experimental or memory waterfalls, and search for wine.)

There's also Dr. Memory, see

@John Dibling 2010-02-04 21:15:45

Because then you wouldn't be debugging a Windows app - you'd be debugging a Linux app.

@Dan Kegel 2010-02-14 03:42:38

No need to recompile in Wine. Just transfer your .exe and .pdb over to a Linux box. And you wouldn't be debugging a Linux app; you're debugging your exact Windows app.

@alternative 2010-10-21 20:23:07

Exactly, its better to use the real thing than a lame clone :D Love valgrind.

@Imbrondir 2011-05-06 10:07:36

Nice! From windows you could run a virtual machine running linux, running your software in the almost vm wine, in the valgrind vm. Bonus points if windows is run from a vm running linux inside a windows vm :)

@Rob Wells 2009-10-01 09:11:09

Definitely Purify! I've used that to analyze some massive code bases (>3,000 kSLOC) and found it to be excellent.

You might like to look at this list at Wikipedia.

By the way, I've found memwatch to be useful. Thanks Johan!

@Kirill V. Lyadvinsky 2009-10-01 18:20:57

The user-mode dump heap (UMDH) utility works with the operating system to analyze Windows heap allocations for a specific process. That's a pretty good tool for free from Microsoft. Here is a mini tutorial "How to use Umdh.exe to find memory leaks".

@Satbir 2009-10-01 13:59:54

i would like to list some tool , hope will be useful

read this article for more detail

  1. Purify
  2. Bounds Checker
  3. Coverity (basically its a code analyzer but, it will catch memory leak in static )
  4. Glow Code
  5. dmalloc
  6. ccmalloc
  7. NJAMD
  8. YAMD
  9. Valgrind
  10. mpatrol
  11. Insure++

@MastAvalons 2012-01-11 19:48:56

add Deleaker....

@Patrice Bernassola 2009-10-01 12:15:56

You can give a try to RuntimeChecker trial ot to IBM Purify trial..

A free solution would be to use the following code in Visual Studio:

#ifdef _DEBUG
#define new DEBUG_NEW

Just write this in the top of all your cpp files. This will detect memory leaks of your application whenc stopping debug run and list them in the output window. Double clicking on a memory leaks line will higlight you the line where memory is allocated and never released. This may help you :

@Cristian Adam 2009-10-01 11:41:28

You might want to read what Mozilla is doing regarding memory leaks. One tool in their toolbox is the Hans Boehm garbage collector used as memory leak detector.

@Dror Helper 2009-10-01 10:23:01

The best tool I ever used is DevPartner BoundsChecker - it's not free but it has an evaluation period.

@Red 2009-10-01 09:42:05

I used Insure++ which does excellent job in finding c++ memory leaks/corruptions and many other bugs like uninitialized variables, pointer errors, strings etc., It also does visual "Code coverage" and run time memory usage etc.. which give more confident on your code.. You can try it for trail version..

@RED SOFT ADAIR 2009-10-01 09:32:17

More or less all Profilers include checking for memory leaks and show you the stack when the memory was allocated.

I can recommend Intels Parallel Inspector. Simple to use and no recompilation needed. The trial version runs for 30 days.

GlowCode and AtromatedQA also include such capabilites. They all offer free trials.

Compuware DevPartner (aka BoundsChecker) in Contrast needs a slowed down "instrumentation" recompile and the application also runs slower when checking for errors. And BoundsChecker can not work with 64 Bit evsrions at all. We gave up on that tool.

@Bob 2009-10-01 09:35:47

I'd defintitely recommend glowcode. I've used it in the past to find an memory leak within a dll being called by my app.

@Calyth 2009-10-01 12:44:16

There were complaints of major slowdowns while using DevPartner at my last workplace. They do everything to avoid using it because of how slow it would be.

@fmuecke 2009-10-01 09:16:32

Viusual Studio can help detecting memory leaks itself. See Microsoft Visual C++ Tips and Tricks -> "Memory Leaks" section. See also this post in SO

Although real tracing is only possible with the Team Edtion of Visual Studio.

@maykeye 2009-10-01 09:07:03

Check out this question: Is there a good Valgrind substitute for Windows? . Though general substitute for valgrind is asked, it mainly discusses memory leak detectors and not race conditions detections.

@Diaa Sami 2009-08-28 01:16:54


Related Questions

Sponsored Content

33 Answered Questions

[SOLVED] Reference - What does this error mean in PHP?

28 Answered Questions

[SOLVED] How can you find out which process is listening on a port on Windows?

23 Answered Questions

[SOLVED] Is there an equivalent of 'which' on the Windows command line?

34 Answered Questions

[SOLVED] How do I install pip on Windows?

10 Answered Questions

[SOLVED] Improve INSERT-per-second performance of SQLite?

39 Answered Questions

[SOLVED] Activity has leaked window that was originally added

40 Answered Questions

[SOLVED] Can't start Eclipse - Java was started but returned exit code=13

10 Answered Questions

27 Answered Questions

[SOLVED] How to debug in Django, the good way?

7 Answered Questions

[SOLVED] What is a stack trace, and how can I use it to debug my application errors?

Sponsored Content