Mtrace memory leak check tool

installation

yum install glibc-utils

Increase header file reference

#include <mcheck.h>

 

Called in the main function

setenv("MALLOC_TRACE", "mtrace.out", 1);
mtrace();

 

Compile

gcc -g test.c -o test

 

carried out

./test

 

analysis

mtrace test mtrace.out

 

 

 

 

 

Guess you like

Origin blog.csdn.net/woailp___2005/article/details/106361101