valgrind --leak-check=full --show-reachable=yes --log-file=a.log ./shdaily.fcgi "op=search&date=2011-04-14

valgrind --leak-check=full  --show-reachable=yes  --log-file=a.log ./shdaily.fcgi "op=search&date=2011-04-14&current=4"

glib使用如下:

G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20  ./egg2Utest "ItfTest"

常用命令详解:

G_DEBUG=gc-friendly

G_SLICE=always-malloc     //glib有缓存  故需使用

上述两条设置环境变量 G_SLICE和G_DEBUG排除由内存分配机制带来的影响

--tool=memcheck     //使用valgrind的memcheck功能

-show-reachable=yes    //是否检测控制范围之外的泄漏,比如全局指针、static指针等

--log-file=a.log      //结果输出到文件

--leak-check=full      //显示具体代码中泄漏的地方

--leak-resolution=high     //

--num-callers=20

严格通用

G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --show-reachable=yes --log-file=a.log  ./app

posted @ 2011-06-10 11:27  wangkangluo1  阅读(3415)  评论(0编辑  收藏  举报