WinDbg - 查看 System.Web.Compilation.BuildManager 的 ResultCache
我正在调试内存泄漏。我无法重现它,但当程序在特定情况下运行时,我会得到大约 60MB/小时的稳定泄漏。几天后,当堆达到约 2GB 时,我进行转储并附加 WinDbg。
!heapdump –stat
显示有 1.2 GB 的哈希表。 这大约占堆的 55%。
!dumpheap -类型 System.Collections.Hashtable+KeyCollection
给出 153,080 个 Hashtable 实例的地址。
其中一些实例的 !gcroot 表明它们全部由 Me.Logger 拥有的线程拥有。
RSP:28f67e840:Root:0000000245edb7d0(Me.Logger)->
0000000245edb9d8(System.Threading.Thread)->
00000002459b9830(System.Runtime.Remoting.Contexts.Context)->
00000002459b9548(System.AppDomain)->
0000000245a1fed0(System.ResolveEventHandler)->
00000002259697a0(System.Web.Compilation.BuildManager)->
0000000245a20120(System.Web.Compilation.MemoryBuildResultCache)->
00000002459c2a48(System.Web.Caching.CacheMultiple)->
00000002459c2a70(System.Object[])->
00000002459c7e08(System.Web.Caching.CacheSingle)->
00000002459c9008(System.Web.Caching.CacheUsage)->
00000002459c9030(System.Object[])->
00000002459c9138(System.Web.Caching.UsageBucket)->
00000001b996fba8(System.Web.Caching.UsagePage[])->
00000001ae054388(System.Web.Caching.UsageEntry[])->
0000000251576590(System.Web.Caching.CacheEntry)->
00000002515761a0(System.Web.Mobile.MobileCapabilities)->
00000002515742c8(System.Collections.Hashtable)->
0000000251576548(System.Collections.Hashtable+KeyCollection)
我不知道如何解释这个输出。看来 System.Web.Compilation.BuildManager 只是有一个巨大的缓存。
BuildManager、MobileCapability、ResolveEventHandler - 我在我的代码库中没有使用任何这些。
我是 WinDbg 的新手。我如何进一步调试这个?
我怎样才能看到哈希表中的内容? (SoS v2.0.50727 所以没有!DumpCollection)。 我怎样才能看到 BuildManager 构建了什么?
I'm debugging a memory leak. I cannot reproduce it, but when the program runs in specific circumstances I get a steady leak at about 60MB/hr. After several days, I take a dump when the heap is ~2GB and attach WinDbg.
!heapdump –stat
Shows there are 1.2 GB worth of Hashtables.
This is about 55% of the heap.
!dumpheap -Type System.Collections.Hashtable+KeyCollection
Gives address of the 153,080 Hashtable instances.
!gcroot of a few of these instances indicate that they are all owned by Threads owned by Me.Logger.
RSP:28f67e840:Root:0000000245edb7d0(Me.Logger)->
0000000245edb9d8(System.Threading.Thread)->
00000002459b9830(System.Runtime.Remoting.Contexts.Context)->
00000002459b9548(System.AppDomain)->
0000000245a1fed0(System.ResolveEventHandler)->
00000002259697a0(System.Web.Compilation.BuildManager)->
0000000245a20120(System.Web.Compilation.MemoryBuildResultCache)->
00000002459c2a48(System.Web.Caching.CacheMultiple)->
00000002459c2a70(System.Object[])->
00000002459c7e08(System.Web.Caching.CacheSingle)->
00000002459c9008(System.Web.Caching.CacheUsage)->
00000002459c9030(System.Object[])->
00000002459c9138(System.Web.Caching.UsageBucket)->
00000001b996fba8(System.Web.Caching.UsagePage[])->
00000001ae054388(System.Web.Caching.UsageEntry[])->
0000000251576590(System.Web.Caching.CacheEntry)->
00000002515761a0(System.Web.Mobile.MobileCapabilities)->
00000002515742c8(System.Collections.Hashtable)->
0000000251576548(System.Collections.Hashtable+KeyCollection)
I don't know how to interpret this output. It seems that System.Web.Compilation.BuildManager just has a massive cache.
BuildManager, MobileCapabilities, ResolveEventHandler - I don't use any of this in my codebase.
I am new to WinDbg. How do I debug this further?
How could I see what's in the Hashtables? (SoS v2.0.50727 so no !DumpCollection).
How could I see what BuildManager has built?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试过 SOSEX 扩展吗? http://www.stevestechspot.com/default.aspx。
它具有 SOS 的大部分功能,包括您需要的 !DumpCollection 命令(尽管我还没有测试它是否适用于 CLR V2),也许还有一些其他有用的东西。
也可能是这个博客可以帮助你,她有一些关于托管内存泄漏调试的很好的信息:
http://blogs.msdn.com/b/tess/archive/2008/04/03/net-debugging-demos-lab -7-内存泄漏-review.aspx?PageIndex=1
Have you tried the SOSEX extension? http://www.stevestechspot.com/default.aspx.
It has most of the functionality of SOS including !DumpCollection command that you need (although I haven't tested if it works with V2 of the CLR) and maybe some other useful things..
Also maybe this blog can help you, she has some pretty good information on managed memory leak debugging:
http://blogs.msdn.com/b/tess/archive/2008/04/03/net-debugging-demos-lab-7-memory-leak-review.aspx?PageIndex=1