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

5k views Asked by At

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 -

enter image description here

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

There are 1 answers

0
sedau79 On

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