- 论坛徽章:
- 0
|
我用valgrind进行内存检测
我在1 和2.so中特意留下内存未释放的错误 然后用valgrind检查
结果
[root@localhost so]# valgrind --tool=memcheck --leak-check=full ./1
==14787== Memcheck, a memory error detector.
==14787== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==14787== Using LibVEX rev 1658, a library for dynamic binary translation.
==14787== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==14787== Using valgrind-3.2.1, a dynamic binary instrumentation framework.
==14787== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==14787== For more details, rerun with: -v
==14787==
1111111
==14787==
==14787== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 1)
==14787== malloc/free: in use at exit: 1,892 bytes in 7 blocks.
==14787== malloc/free: 12 allocs, 5 frees, 3,292 bytes allocated.
==14787== For counts of detected errors, rerun with: -v
==14787== searching for pointers to 7 not-freed blocks.
==14787== checked 72,936 bytes.
==14787==
==14787== 4 bytes in 1 blocks are definitely lost in loss record 1 of 7
==14787== at 0x4A05809: malloc (vg_replace_malloc.c:149)
==14787== by 0x4D1C6E5: ???
==14787== by 0x400696: main (1.c:22)
==14787==
==14787==
==14787== 512 bytes in 1 blocks are definitely lost in loss record 6 of 7
==14787== at 0x4A05809: malloc (vg_replace_malloc.c:149)
==14787== by 0x4006A9: main (1.c:24)
==14787==
==14787== LEAK SUMMARY:
==14787== definitely lost: 516 bytes in 2 blocks.
==14787== possibly lost: 0 bytes in 0 blocks.
==14787== still reachable: 1,376 bytes in 5 blocks.
==14787== suppressed: 0 bytes in 0 blocks.
==14787== Reachable blocks (those to which a pointer was found) are not shown.
==14787== To see them, rerun with: --show-reachable=yes
请问下 为什么valgrind 检查不到so里面内存泄露的地方呢?在SO 文件地方的位置就是??? 请问应该如何操作呢? |
|