Valgrind总结:输出中是否存在内存泄漏?
Summary of Valgrind : is there a memory leak in the output?
我的程序是用c++写的,我运行valgrind来检查内存问题。然而,我不太确定,当分配的内存比释放的内存多,但摘要说没有泄漏时,会发生什么。下面是下面命令的输出:
valgrind --leak-check=full ./myprogram
输出(Centos 6):
==28196==
==28196== HEAP SUMMARY:
==28196== in use at exit: 66,748 bytes in 1 blocks
==28196== total heap usage: 7 allocs, 6 frees, 67,964 bytes allocated
==28196==
==28196== LEAK SUMMARY:
==28196== definitely lost: 0 bytes in 0 blocks
==28196== indirectly lost: 0 bytes in 0 blocks
==28196== possibly lost: 0 bytes in 0 blocks
==28196== still reachable: 66,748 bytes in 1 blocks
==28196== suppressed: 0 bytes in 0 blocks
==28196== Reachable blocks (those to which a pointer was found) are not shown.
==28196== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==28196==
==28196== For counts of detected and suppressed errors, rerun with: -v
==28196== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
Profiling timer expired
谁能详细说明一下镇压问题?
谢谢
仍然可达意味着您有指向内存的指针,但在关闭之前没有释放它。在大多数情况下,这意味着不存在有问题的内存泄漏,因为大多数情况下,这是一个您填充的数据结构,但在关闭之前没有释放。
这个问题Valgrind检测到的仍然可到达的泄漏在顶部的答案中有更多的解释。
EDIT:详细说明一下,valgrind可以读取文件来抑制某些错误,这个注释是suppresst2 from 2,意味着从被抑制的错误列表中也找到了2个错误。错误通常被抑制,因为它们在第三方库中,或者已知不会引起问题。有关抑制错误的更多信息,请查看valgrind对错误抑制的解释
相关文章:
- 这个极客对极客的trie实现是否存在内存泄漏问题
- 为什么以下C++代码中存在内存泄漏?
- 以下代码是否存在内存泄漏?
- 存在内存访问异常,但我不确定我的代码中出了什么问题
- gpc服务器不会释放内存,是否存在内存泄漏?
- 存在内存泄漏问题的链接列表
- QT图像查看器示例,可能存在内存泄漏
- 为什么堆栈中的函数局部变量之间存在内存空间
- C :当居民记忆缓慢增加时,是否存在内存泄漏
- 是否存在内存泄漏,如果是,为什么?
- 如果函数返回 std::vector<std::string>,是否存在内存泄漏?
- 检测到指针引用可能存在内存泄漏
- 是否可能存在内存泄漏以在堆上分配shared_ptr
- 在这个关于指针的C++代码示例中是否存在内存泄漏
- 是否存在内存泄漏
- 尽管释放了分配的内存,但仍存在内存泄漏
- 复制构造函数中存在内存泄漏
- 优先级队列中可能存在内存泄漏
- C++中非常大的数组存在内存问题
- 如果我将一个POD结构分配给另一个POD组织,是否存在内存泄漏