可以valgrind报告丢失块的内存地址(用于调试递归函数调用)
Can valgrind report a memory address of a lost block (for debugging recursive function calls)?
这个问题与我的问题最相似,但它相当古老,所以我想知道从那以后是否有什么变化。
我的valgrind输出是:
==29443== 109 (16 direct, 93 indirect) bytes in 2 blocks are definitely lost in loss record 270 of 309
==29443== at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29443== by 0x4F4E8DB: grl::Configuration::Configuration(grl::Configuration const&) (configuration.h:192)
==29443== by 0x4F49973: grl::YAMLConfigurator::load(YAML::Node const&, grl::Configuration*, std::string const&) (configurable.cpp:74)
==29443== by 0x4F499FC: grl::YAMLConfigurator::load(YAML::Node const&, grl::Configuration*, std::string const&) (configurable.cpp:75)
==29443== by 0x4F499FC: grl::YAMLConfigurator::load(YAML::Node const&, grl::Configuration*, std::string const&) (configurable.cpp:75)
==29443== by 0x4F499FC: grl::YAMLConfigurator::load(YAML::Node const&, grl::Configuration*, std::string const&) (configurable.cpp:75)
==29443== by 0x40C78E: grl::YAMLConfigurator::load(std::string, grl::Configuration*, std::string const&) (configurable.h:321)
==29443== by 0x40B897: main (deployer.cpp:180)
程序在开始时配置为递归调用从yaml文件读取并将所有所需参数存储在映射中作为一对(name, allocated address)
。我可以打印这些双。因此,如果valgrind可以告诉我一个丢失值的地址,那么我就可以获得一个参数的名称,并检查它为什么没有被释放。
如果功能不可用,我还能用什么?
您可以使用vgdb在valgrind+gdb下运行程序。看见http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
然后,您可以使用各种valgrind memcheck monitor命令来执行泄漏搜索并具有泄漏块的地址/大小。看见http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-命令
相关文章:
- 如何在可视化代码中生成用于 c++ 开发的调试器?
- 代码适用于调试,但不适用于发布
- 用于自定义调试构建的 CMake qt 输入库后缀
- 在Linux Mint 19下,从哪里提取wxWidgets的源代码(.cpp文件)用于步骤内部调试
- 设置用于调试的 g++ 编译器标志
- 组织从内存读取的数据的最佳方法(用于调试)c++
- C++:用于调试的类的字符串表示形式
- 编译库的C 挂钩函数用于调试
- 可以valgrind报告丢失块的内存地址(用于调试递归函数调用)
- 有选择地内联函数(用于调试目的)
- 用于C++调试项目的 IDE
- 用于调试和发布模式的宏
- 用于调试X86构建的Visual Studio链接器错误
- 创建一个简单的窗口来输出用于调试的信息(日志样式)- wxWidgets
- 用于调试消息的跨平台GUI应用程序控制台
- 用于调试Borland和Visual Studio应用程序的工具
- 是否有一种方法可以将一个条件设置为gdb中的所有断点,用于调试Cpp代码
- 用于调试的未初始化内存的常用值是什么?
- gdb:什么是用于调试的符号文件
- 用于调试混合c++和Java代码的实用方法