Valgrind Toolcase

Install Valgrind via APT

sudo apt install valgrind

Compile the source program

To compile the program use the following flags:

  • -g3
  • -O0 (optional)

Example in C

gcc -g -Wall *.c

Example in C++

g++ -g -Wall *.cpp

Execute target with Valgrind

To execute the program once you have compiled it:

./valgrind program

Advanced options

Enable extensive leak checking

For extensive testing you could also use the following flags:

--track-origins=yes --vgdb=yes

Ignore forked children

To ignore forked children use the flag:



If you are creating threads you could also use one of following tools:





Leave a Reply