问题描述
0:000> !dumpheap -stat
total 1755874 objects
Statistics:
MT Count TotalSize Class Name
7b9b0c64 1 12 System.Windows.Forms.Layout.TableLayout+ColumnSpanComparer
....
7933303c 14006 4926456 System.Collections.Hashtable+bucket[]
65246e00 804 4982192 System.Data.RBTree`1+Node[[System.Int32, mscorlib]][]
054c55f0 44240 5662720 DevExpress.Utils.AppearanceObject
793040bc 98823 7613156 System.Object[]
793308ec 293700 55820016 System.String
002435f0 50315 138631888 Free
Total 1755874 objects
Fragmented blocks larger than 0.5 MB:
Addr Size Followed by
15a195c8 0.8MB 15ae3950 System.Collections.ArrayList
15d81468 1.6MB 15f23708 System.String
15f23984 1.0MB 16029ae4 System.String
... about 7 more objects here
1ee51764 0.5MB 1eedbaa4 System.WeakReference
1f0df96c 2.4MB 1f34d4b0 System.String
1f3e1ca8 3.7MB 1f79afc4 System.WeakReference
我一直在阅读有关牵制和分散。其面色支离破碎我给出的自由空间的巨量。我想我必须现在追查。
I've been reading about pinning and fragmentation. Its looking fragmented to me given the massive amount of free space. I guess I have to now track it down.
思考?反馈?
推荐答案
所以......我们知道我们有一个支离破碎的堆。接下来的问题是:是什么导致了不成?什么是保持被释放这些免费对象?我已阅读的建议是检查对象的自由空间之后:
So...we know we have a fragmented heap. The next question is: what's causing the fragmentation? What's keeping these free objects from being released? The recommendations I have read is to examine the objects right after the free space:
1)!dumpheap -stat2)转储自由对象的方法表:!dumpheap -mt 000db8e83)从列表中选择一个空闲的对象来更仔细地审查:dumpobj 0x2003b0b04)记录对象的大小5)转储的下一个对象后:dumpobj 0x2003b0b0 + 10006)查找拿着一个参考的对象!gcroot 0x2003b0b0 + 10007)转储中的对象的GCHandle。
1) !dumpheap -stat2) Dump the method table of the Free object: !dumpheap -mt 000db8e83) Select one Free object from the list to examine more closely: !dumpobj 0x2003b0b04) Record the object's size5) Dump the next object after it: !dumpobj 0x2003b0b0+10006) Find the object holding a reference !gcroot 0x2003b0b0+10007) Dump the gchandle of the object found.
我通常会沿着这兔子洞,而.NET API的我有限的知识无法在这里。这是调试问题的正确方法是什么?
I usually get down this rabbit hole, and my limited knowledge of the .NET API fails here. Is this the correct way to debug the problem?
杰夫
这篇关于是我的堆碎片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!