如何使用 !DumpHeap (.load sos) 仅转储第一个对象地址
我的内存中有几百万个对象。我想找到它们的 gcroot,所以我需要一个对象地址。然而,DumpHeap 转储所有对象所花费的时间比我耐心等待的时间还要长。我怎样才能将其输出限制为只有一个对象地址?顺便说一句,我正在使用 Visual Studio 2008。
I habe a few million objects hanging around in memory. I want to find the gcroots for them so I need an object address. !DumpHeap however dumps all objects which is taking longer than i had the patience to wait. How can i limit its output to only one object address? I am using Visual Studio 2008 btw.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
杰森·埃文斯是对的。我的版本没有 -l 开关,因此这是我使用的解决方法:我使用 end 参数将输出限制为这样的地址范围:
最后一个地址是我允许的最高地址。通过小步增加地址,我最终击中了前几个对象。
Jason Evans is right. My version does not have the -l switch, so here is the workaround I use: I use the end parameter to restrict the output to an address range like this:
The last address is the highest address I allow. By increasing the address in small steps, I eventually hit the first few objects.
只会转储对象的地址
Will only dump the address of the objects
查看这个 页面。看起来您可以用来
限制显示的项目数量。
Check out this page. It looks like you can use
to limit the number of items shown.
最好的起点是 -stat 参数。这将转储活动对象表的摘要,而不是系统中的每个对象。它会让您很好地了解哪些对象造成了最大的开销,
我还建议您查看以下博客文章,因为它们旨在帮助人们使用 WinDbg 来追踪此类问题
The best place to start is the -stat argument. This will dump a summary of the live object table as opposed to every object in the system. It will give you a good idea on what objects in particular are causing the most overhead
I would also recomend taking a look at the following blog articles as they are geared to helping people use WinDbg to track down this sort of problem