我正在调查使用WinDbg的32位应用程序的堆。应用程序的大小正在缓慢增长,直到抛出System.OutOfMemoryException
为止。我知道它经常分配LOH,所以我对堆的那部分特别感兴趣。
此tutorial之后,我运行!eeheap -gc
来查找LOH的起始位置,然后运行!dumpheap -stat <LOH-start-address>
。
我在教程中看到LOH中的所有对象的总大小超过85,000个字节,这是有道理的。但是,我自己的LOH在这个大小下有许多对象。可能是什么原因造成的?
我看过其他一些教程,以确保我正确地解释了结果。阅读此one之后,我尝试运行!dumpheap –mt <methodtable>
来获取LOH中一个小对象的地址,然后是!dumpobj <address>
。但是,该对象仍然小于85,000字节。
例如,我运行这些命令来查看下面显示的StringBuilder
对象之一。支持Char[]
仅524字节。
以下是!dumpheap -stat <LOH-start-address>
的输出摘要。我省略了许多甚至小于列表中最高的对象。
...
6ce5ba24 383 48276 System.Xml.Schema.XmlSchemaObjectTable+XmlSchemaObjectEntry[]
6ce6ac58 14 52392 System.Xml.NameTable+Entry[]
6ce62d80 623 54824 System.Xml.Schema.XmlSchemaAttribute
708023d0 2809 78652 System.Text.StringBuilder
70800958 1454 90336 System.Int32[]
70800460 2531 91024 System.Type[]
6ce5bc04 383 91300 System.Collections.Generic.Dictionary`2+Entry[[System.Xml.XmlQualifiedName, System.Xml],[System.Xml.Schema.XmlSchemaObject, System.Xml]][]
6ce67e30 5145 102900 System.Xml.XmlQualifiedName
6ce611c8 1451 139296 System.Xml.Schema.SchemaElementDecl
6ce63070 1105 167960 System.Xml.Schema.XmlSchemaElement
6ce6ac20 10202 204040 System.Xml.NameTable+Entry
70801ab8 183 366912 System.Collections.Hashtable+bucket[]
708032d0 94447 2266728 System.Collections.ArrayList
02fbe930 13110 2645968 Free
707fef34 96184 2910092 System.Object[]
6ce689d4 190453 3047248 System.Xml.XmlAttributeCollection
6ce69c38 329640 6592800 System.Xml.XmlAttribute
6ce68700 426488 8529760 System.Xml.XmlText
6ce67ed0 349123 9775444 System.Xml.XmlElement
7080316c 5287 44288168 System.Byte[]
707ff54c 2818 44655356 System.Char[]
707feb40 331949 102379016 System.String