如何使用 !gcroot
从加载了 SOS 调试扩展的 Visual Studio 即时窗口中,我可以执行
!dumpheap -stat
以下操作 然后我得到类似这样的信息:
total 108,014 objects
Statistics:
MT Count TotalSize Class Name
...
0x00be209c 135 714108 System.Object[]
0x79b925c8 218 2659728 System.String
0x00be2c3c 78986 10,705,064 System.Byte[]
Total 208,014 objects, Total size: 36,259,364
How can I call !gcroot on some of the System.Byte[]实例现在?我首先必须找到他们的地址。但是使用 !dumpheap -type System.Byte[] 肯定是一个坏主意,因为这会给我一个无休止的列表,并且由于即时窗口似乎很慢,所以需要 20 多分钟才能列出它们 - 在那个时候 Visual Studio 不可用。是否有一个秘密技巧如何在某些字节数组上调用 !gcroot ?
From within visual studio immediate window with SOS debugging extension loaded I can do
!dumpheap -stat
Then I get something like this:
total 108,014 objects
Statistics:
MT Count TotalSize Class Name
...
0x00be209c 135 714108 System.Object[]
0x79b925c8 218 2659728 System.String
0x00be2c3c 78986 10,705,064 System.Byte[]
Total 208,014 objects, Total size: 36,259,364
How can I call !gcroot on some of the System.Byte[] instances now? I would first have to find the adress of them. But using !dumpheap -type System.Byte[] is surely a bad idea because that will give me an endless list and since the immediate window seems to be slow it takes more than 20 minutes to list them - duirng that time visual studio is not usable. Is there a sceret trick how I could call !gcroot on some of the byte arrays?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 -min -max 开关过滤掉噪音,我猜您的问题出在大型对象上,因此请调用 !dumpheap -min -type System.Byte[] ,其中足够大以过滤掉噪音。
You can filter out the noise using the -min -max switches, I guess that your problem is with the large objects so call !dumpheap -min -type System.Byte[] where is large enough to filter out the noise.