gpt4 book ai didi

c# - GC generation 3 出现在 windbg 中

转载 作者:可可西里 更新时间:2023-11-01 09:07:40 24 4
gpt4 key购买 nike

我有一个正在运行的进程的转储文件(试图查找内存泄漏)

我注意到的一件事是,当我通过 !do 转储更大的对象时,windbg 告诉我它们是第 3 代 GC ??

所有这些都是字节数组,所以当我查看转储中的所有字节数组时,我可以看到第 0、1、2 和 3 代 GC。

谁能解释一下这里发生了什么,因为我认为只有 3 代 GC。

> 0:000> !do 0x0000000011b47450 
Name: System.Byte[]
MethodTable: 000007fef7d2e798
EEClass: 000007fef7932670
Size: 131096(0x20018) bytes
GC Generation: 3
Array: Rank 1, Number of elements 131072, Type Byte
Element Type: System.Byte
Fields:
None

最佳答案

.NET Framework 有第四个堆(“生成”)专门用于大对象,称为——足够恰当——大对象堆。大于 85,000 字节的对象被分配到该堆上。

供引用:http://msdn.microsoft.com/en-us/magazine/cc163833.aspx

One undocumented feature of the "!dh" command is that you can easily look at the large object heap as well. In looking at a lot of output, I noticed some values listed as coming from Generation 3. Because the .NET garbage collector, at least according to everything I read, only has the three generations (0, 1, and 2), I was a little confused. Thinking it may be the large object heap, I manually dumped the large object heap and compared values. Sure enough, that's what I saw. To see the objects in the large object heap, use 3 as the generation like this: "!dh –stat –gen 3".

关于c# - GC generation 3 出现在 windbg 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8330503/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com