简体   繁体   English

使用valgrind找出如何仍然可以到达对象

[英]Using valgrind to find out how an object is still reachable

I use valgrind for memory leak detection. 我使用valgrind进行内存泄漏检测。 There was some code I was expecting to produce a memory leak, but valgrind did not detect it. 我曾期望有一些代码会产生内存泄漏,但是valgrind没有检测到它。 Now I would like to find out in what way this object might still be reachable (this would be a problem in this case). 现在,我想找出以何种方式仍然可以访问该对象(在这种情况下,这将是一个问题)。 Can valgrind output those references? valgrind可以输出那些引用吗?

Upgrade to the (not yet released) 3.8.0 SVN version of Valgrind. 升级到Valgrind的3.8.0 SVN版本(尚未发布)。 You then have the following gdbserver monitor commands: 然后,您将具有以下gdbserver监视器命令:

  block_list <loss_record_nr> after a leak search, shows the list of blocks of <loss_record_nr> who_points_at <addr> [<len>] shows places pointing inside <len> (default 1) bytes at <addr> (with len 1, only shows "start pointers" pointing exactly to <addr>, with len > 1, will also show "interior pointers") 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM