views:

21540

answers:

15

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.

+2  A: 

I had the chance to use Compuware DevPartner Studio in the past and that was really good, but it's quite expensive. A cheaper solution could be GlowCode, i just worked with a 5.x version and, despite some problems in attaching to a process i needed to debug, it worked quite well.

Manuel
Expensive yes. It paid back in one weekend, just using the profiler piece.
EvilTeach
+2  A: 

See the "Source Test Tools" link on the Software QA Testing and Test Tool Resources page for a list of similar tools.

I've used BoundsChecker,DevPartner Studio and Intel V-Tune in the past for profiling. I liked V-Tune the best; you could emulate various Intel chipsets and it would give you hints on how to optimize for that platform.

Patrick Cuff
A: 

Perhaps CodeSnitch would be something you're after? http://www.entrek.com/codesnitch.html

Alex Fort
+1  A: 

I've been loving Memory Validator, from a company called Software Verification.

stevex
+9  A: 

Development environment for Windows you are using may contain its own tools. Visual Studio, for example, lets you detect and isolate memory leaks in your programs

dmityugov
It is of very little practical use. It will log the filename/linenumber for offending allocations, but it's only informative if you call malloc directly. When using new/delete, it will unhelpfully pinpoint new.h as the "offending" code.
It works correctly for me, pointing the right line even new/delete are used.
Rodrigo
But will it work if a library function allocates? E.g. strdup.
Alex
The Debug CRT, which is what you are trying to describe is useful for C code. Getting it to work for C++ code is more problematic.
C Johnson
+9  A: 

Some more good commercial tools:

orip
Purify: venerable but still useful, as shown by how many changes of corporate ownership it has survived!
Norman Ramsey
Kinda expensive though...
George Edison
Insure++ takes forever to instrument your code, and forever to execute your code at runtime.
C Johnson
+5  A: 

There is Pageheap.exe part of the debugging tools for Windows. It's free and is basically a custom memory allocator/deallocator.

See http://support.microsoft.com/kb/286470

pspda5id
Pageheap/gflags have helped me get to the bottom of some nasty heap corruption problems.
the_mandrill
A: 

If you are developing with Borland/CodeGear/Embarcadero C++ Builder, you could use CodeGuard.

Vince
+6  A: 

Try DUMA

Diaa Sami
+4  A: 

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 http://dmoulding.googlepages.com/vld.

tgs_stdio
Works well for me too
the_mandrill
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. :-|
Synetech inc.
+3  A: 

Why not use Valgrind + Wine to debug your Windows app? See http://wiki.winehq.org/Wine_and_Valgrind

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

There's also Dr. Memory, see dynamorio.org/drmemory.html

Dan Kegel
I'll install linux and valgrind and wine and recompile my whole project in wine, that REALLY make sense
Eric
Because then you wouldn't be debugging a Windows app - you'd be debugging a Linux app.
John Dibling
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.
Dan Kegel
Exactly, its better to use the real thing than a lame clone :D Love valgrind.
mathepic
A: 

Does Jochen Kalmbach's Memory Leak Detector qualify?

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

Vulcan Eager
+1  A: 

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

Alex
+1  A: 

The Boost Test library can detect memory leaks.

zr
A: 

If you're not afraid of mingw, here are some links (some might work with MSVC)... http://betterlogic.com/roger/?p=1140

rogerdpack