读书人

关于linux检测内存泄露有关问题

发布时间: 2012-04-23 13:17:38 作者: rapoo

关于linux检测内存泄露问题
使用 valgrind 检测程序内存泄露问题,在网上查到的资料一般都是对单个程序进行检查。想知道怎么对运行的程序某个函数调试?

[root@linux67 ~]# valgrind --tool=memcheck --leak-check=yes ./clpwebmc
valgrind: ./clpwebmc: No such file or directory
[root@linux67 ~]# valgrind --tool=memcheck --leak-check=yes clpwebmc
==25958== Memcheck, a memory error detector.
==25958== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==25958== Using LibVEX rev 1854, a library for dynamic binary translation.
==25958== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==25958== Using valgrind-3.3.1, a dynamic binary instrumentation framework.
==25958== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==25958== For more details, rerun with: -v
==25958==
libcrypto.so.1
libcrypto.so.2
libcrypto.so.3
libcrypto.so.4
libcrypto.so.5
libcrypto.so.6
dlopen(libcrypto.so.6) successfully
dlsym(libcrypto.so.6) successfully
read [/root/dummyconf] failed.
read value error [/root/webmgr/http/mime/addtype13/type/content].
clpwebmc: already running [pid 24875].
==25958==
==25958== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 42 from 1)
==25958== malloc/free: in use at exit: 10,744 bytes in 81 blocks.
==25958== malloc/free: 5,376 allocs, 5,295 frees, 1,126,060 bytes allocated.
==25958== For counts of detected errors, rerun with: -v
==25958== searching for pointers to 81 not-freed blocks.
==25958== checked 495,488 bytes.
==25958==
==25958== LEAK SUMMARY:
==25958== definitely lost: 0 bytes in 0 blocks.
==25958== possibly lost: 0 bytes in 0 blocks.
==25958== still reachable: 10,744 bytes in 81 blocks.
==25958== suppressed: 0 bytes in 0 blocks.
==25958== Reachable blocks (those to which a pointer was found) are not shown.
==25958== To see them, rerun with: --leak-check=full --show-reachable=yes
[root@linux67 ~]#

[解决办法]
貌似参数中是不支持这种检测方式;
因为,从技术上,这种比较难实现一点吧
[解决办法]
这个不能吧

读书人网 >C++

热点推荐