在 WinDbg 中比较两个对象地址
有没有办法知道两个地址(对两个对象的引用)是否连接?我所说的连接是指其中一个对象是否拥有对另一个对象的引用。
Is there a way to know if two addresses, which are references to two objects are connected ? By connected I mean whether one of the objects holds a reference to the other object.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在大多数语言中,存储引用另一个对象的内存将包含指向另一个对象的指针。那么困难在于确定这段记忆从哪里开始和结束。
如果您使用 .Net,有一个名为 sosex 的 Windbg 扩展,它公开了一个 !refs 命令,显示立即来自和到给定对象的引用。
如果使用本机代码,可以使用 !heap -p -a 获取包含某个对象的逻辑内存块,然后检查该内存是否包含指向另一个对象内存的指针。
In most languages, the memory storing the object referencing the other will contain a pointer to the other object. The difficulty is then to determine where this memory starts and end.
If you are in .Net, there is a windbg extension named sosex that exposes a !refs command displaying the immediate references from and to a given object.
If you are in native code, you can use !heap -p -a to obtain the logical memory block containing an object and then check if this memory contains a pointer to the memory of the other object.