Memory leak inspection program - valgrind

Valgrind is a software development tool for memory debugging, memory leak detection and performance analysis. Including Memcheck other tools.

1.valgrind installation

From valgrind official website in order to download the source code executed on unpacked

./configure

make

sudo make install

Enter valgrind -h to see if the installation was successful

2, memory test

For C / C ++ program using compiler option -g been compiled binaries myprog

Generally use the following command to run the program myprog:

valgrind --tool=memcheck  --leak-check=yes myprog arg1 arg2 

 

Guess you like

Origin www.cnblogs.com/Pan-Z/p/11579151.html