Start here · Essential guide
How to Use Valgrind With C++
Learn how to install Valgrind, build a C++ program for it, run Memcheck, and read leak and memory error reports, with examples you can try yourself.
Strings, Containers and Memory
How to find memory leaks with Valgrind and set up a program for GDB.
Start here · Essential guide
Learn how to install Valgrind, build a C++ program for it, run Memcheck, and read leak and memory error reports, with examples you can try yourself.
Yes, Valgrind works with C++ on Linux systems. Learn what it checks in C++ code, how it reports new and delete mismatches, and where it falls short.
Compile a C program with -g and -O0 so GDB shows line numbers and variables, then start a session with gdb ./program and step through your code.
Compare Valgrind, AddressSanitizer, LeakSanitizer, Dr. Memory and Visual Studio's debug heap for finding memory leaks in C++, and when to use each.
Learn when malloc still makes sense in C++ code, how to cast its result, how to pair it with free, and how Valgrind reports mismatched allocations.
Related topics