.NET application memory usage - high unused .NET and unmanaged memory and fragmentation

淺唱寂寞╮ 提交于 2019-12-21 17:02:34

问题


I am using ANTS memory profiler to diagnose an increase in memory leak I am facing in one of my .NET 2.0 applications. I took 7 snapshots of the process over a period of 7.5 hours, and here is a tabular representation of the data obtained -

G1 reprsents generation 1 size and G2 generation 2 size. Except for the unmanaged space and private bytes, all other values are in MB.

My questions are -

  1. Why is there such high unused .NET space even when the heap sizes are low ?

  2. My large object heap goes to a maximum of some 2 MB, and during the last 3 snapshots remains at 96 KB. Then why is there such high large fragments, and are they responsible for the high unused space ?

  3. The unmanaged space increases constantly. Is that responsible for an increase in private bytes over time ?

I am at my wit's end to solve this issue, and have performed several analyses but cant find a proper solution to this. I am ready to provide any other data needed.


回答1:


As Alex already pointed out a very nice explanation of the problem class large object heap fragmentation is found here:

https://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/

The problem is well known in the .NET FX Dev Team and continuously been worked at. There is a good chance that the symptoms fade off using more recent FX releases.

Starting with .NET 4.5.1 there will be a GC method call to even compact the LOH: http://blogs.msdn.com/b/mariohewardt/archive/2013/06/26/no-more-memory-fragmentation-on-the-large-object-heap.aspx However, finding the root cause of the LOHF would be way more efficient than just wiping it of the heap wasting tons of ms's

Let me know, if you need further details how to isolate such effects.

Seb



来源:https://stackoverflow.com/questions/18607121/net-application-memory-usage-high-unused-net-and-unmanaged-memory-and-fragme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!