免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2915 | 回复: 0
打印 上一主题 下一主题

关于valgrind 检测内存泄露问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-26 21:25 |只看该作者 |倒序浏览
我用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 文件地方的位置就是??? 请问应该如何操作呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP