【问题标题】:How do I use !gcroot我如何使用 !gcroot
【发布时间】:2010-11-30 11:53:32
【问题描述】:

在加载了 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

我现在如何在某些 System.Byte[] 实例上调用 !gcroot?我首先要找到他们的地址。但是使用 !dumpheap -type System.Byte[] 肯定是个坏主意,因为这会给我一个无穷无尽的列表,而且由于即时窗口似乎很慢,因此需要 20 多分钟才能列出它们——当时 Visual Studio 不是可用。有什么秘诀可以让我在某些字节数组上调用 !gcroot 吗?

【问题讨论】:

    标签: .net debugging profiling windbg sos


    【解决方案1】:

    您可以使用 -min -max 开关过滤掉噪音,我想您的问题出在大对象上,所以调用 !dumpheap -min -type System.Byte[] ,其中大到足以过滤掉噪音。

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 2011-05-15
      • 1970-01-01
      • 2011-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多