Hi, I was wondering if anyone knew of a good memory leak checker (like valgrind's memcheck) for c++ win32 apps.

Dani AI

Generated

Short summary and context: the OP asked for a Valgrind-style memcheck for Win32 C++. suggested a commercial option, mentioned Visual Leak Detector, and pointed to Visual C++’s built‑in debug helpers (which accepted). Those are solid answers for many cases, but there are additional, complementary tools and workflows that work well on modern Windows and are worth trying.

A few practical alternatives to add to the thread: Dr. Memory — a Valgrind-like, open tool that reports leaks, uninitialized reads, invalid accesses, and some Windows-specific issues. Application Verifier — a Windows SDK tool that stresses and monitors heaps, handles, and common Win32 API misuse. UMDH + GFlags — low-level Microsoft tools that capture heap allocation call stacks for precise diffing. Modern Visual Studio includes native memory snapshots and snapshot diffs in the Diagnostic Tools. MSVC/Clang also support AddressSanitizer builds on Windows for fast runtime checks. (drmemory.org)

Simple workflow that often finds bugs quickly:

  • Build with debug symbols and minimal inlining.

  • Run the program under Dr. Memory to catch invalid reads/writes and leaks:

    drmemory.exe -- c:\path\to\myapp.exe [args]
  • For stubborn heap-growth issues, enable user-mode stack traces with GFlags and capture UMDH logs, then diff them:

    gflags /i MyApp.exe +ust
    umdh -p:<PID> -f:log1.txt
    (exercise app)
    umdh -p:<PID> -f:log2.txt
    umdh log1.txt log2.txt > diff.txt
  • Use Visual Studio memory snapshots to quickly see allocation trends and allocation call stacks; use Dr. Memory/ASan when you need invalid-access detection. (drmemory.org)

Troubleshooting and caveats: these tools slow execution and can produce noise (system-library false positives, or reports from mixed CRTs). Dr. Memory supports allowlist/blocklist tuning; UMDH needs correct symbol paths; AppVerifier requires admin and may deliberately stop on verifier failures. Run with symbols, keep runtimes consistent, and use suppression/allowlists to reduce false positives. (drmemory.org)

Combining a cheap quick check (runtime leak snapshots or CRT checks) with a deeper run under Dr. Memory/ASan and occasional UMDH diffs is a reliable, reproducible strategy for finding hard-to-reproduce Win32 memory bugs.

Recommended Answers

All 5 Replies

How about

Sorry, I was looking for something a little simpler and little more free :P

Sorry, I was looking for something a little simpler and little more free :P

Sorry, I was looking for something a little simpler and little more free :P

Try the built in _CRTDebug Libraries of Visual C++.

commented: Good ~~ SunnyPalSingh +3
commented: Good answer - Salem +4

That was perfect, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.