开发者

Why is large object heap mostly empty?

Why does .NET memory management create such a large object heap? Most of it seems to be empty. Is this something to b开发者_如何学运维e concerned about?

Does the below data mean that in reality I only 179 MB worth of large objects in my application? 179 MB is arrived at by subtracting 983396616 (free LOH) from 1171428792 (Heap0 LOH).

The below info was collected by using WinDbg on a dump file created on a w3wp.exe i.e. ASP.NET process. The process is hosted on a Windows 2008 64-bit operating system. The application is built using Microsoft .NET Framework 4.0 and ASP.NET MVC 3.

0:025> !HeapStat
Heap             Gen0         Gen1         Gen2          LOH
Heap0         4628496      3840808    319586376   1171428792

Free space:                                                 Percentage
Heap0              24           24      1926224    983396616SOH:  0% LOH: 83%


I would suggest running a !DumpHeap -stat Look for the total bytes value for objects named "FREE". These will be free block in the LOH at are available for use, but have been fragmented by thrashing the Large Object Heap. If this number comes close, then you're hitting your LOH with alot of objects that are short lived, and leaving fragments of free memory (remember this heap never compacts itself).


Are you sure much of the LOH has been committed – or is it just reserved address space?

I've just looked at a PowerShell.exe instance here with Sysinternal's VM Map. This shows a total GC heap of ~390MB, but the two largest blocks (~240MB and ~125MB) are reserved. Less than 20MB is committed (ie. physical memory or page file space allocated).

To re-enforce this the total process commit is ~200MB, less than the address space allocated to the GC heaps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜