What is Overhead|Unused in managed heap?

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 1
Joined: Wed Dec 13, 2017 8:28 am

What is Overhead|Unused in managed heap?

Post by codewarrior » Wed Dec 13, 2017 8:54 am

Hi, I am doing memory performance improvements for a server application (.NET 4.6, gc server mode used). It is a memory intensive application usually eats 60~80GB memory, sometimes it can reach >120GB, once that happens, it will keep growing until OOM.
When using.NET Memory profiler (thanks for developing this great tool!) to analyze a dump captured when the application used ~135GB memory, I found that Overhead | Unused uses > 80GB. While LOH uses 16GB and SOH uses 36GB. Looks like most of the heap memory is occupied by it.

Code: Select all

Name	Size
Managed heaps    133,087,836 KB
Large heap          16,090,028 KB
Overhead            80,146,056 KB
    Unused           80,145,568 KB
    Other             488 KB
Normal heap       36,851,752 KB
I read the help, so Overhead is some internal data structure that GC uses to tracking objects, but what is Unused mean? Do I need to free it? Thanks!

Andreas Suurkuusk
Posts: 1035
Joined: Wed Mar 02, 2005 7:53 pm

Re: What is Overhead|Unused in managed heap?

Post by Andreas Suurkuusk » Thu Dec 14, 2017 10:39 pm

The profiler retrieves information about memory that is committed and then classifies the memory according to some heuristics:

Memory at the beginning of a heap, before the first allocated instance: Overhead->Other
Memory used by a reachable instance: Normal/Large heap
Memory used by an unreachable instance: Normal/Large heap->Unreachable instances
Unused memory between instances (reachable and/or unreachable): Normal/Large heap->Gaps
Unused memory after the last allocated instance in a heap: Overhead->Unused

So, "Overhead->Unused" is memory committed by the .NET runtime for the managed heap. It is currently unused, but it is available for future instance allocations. There are lot of rules the runtime uses to decide whether to keep the committed memory or to release it to the OS. It depends on factors like the available memory, allocation patterns, the number of processors, whether the server GC is used, etc.

I'm not sure why the runtime has not released some of the unused memory to the OS, since you have a huge amount of it compared to the total managed memory usage. It should at least be released before you run out of memory.

Unfortunately there is no way for you to free this memory manually.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests