Tutorial :.NET Committed vs. Reserved Heap Size


My program has 7,667,712 bytes of committed heap, yet it has 33,546,240 reserved heap bytes! I can see that the program is using around 44 MB of private bytes. How can I get the .NET GC to reserve less space for the managed heap?


The simplest answer is you can't. The .Net GC is self tuned, it reserve memory eagerly, however it doesn't commit memory until it is needed, when the memory is no longer needed, it is changed to reserved again.

The GC uncommit memory when there are high memory pressure on the machine.

33 MB is not that big, since by default ( if your process is 32 bit and you are running workstation GC mode ), you will have a default segment reserved for the small object heap that is 16 MB.


Just because your process has reserved memory, doesn't mean it's using that memory.

In Windows, Reserved Memory means that your process has mapped pages into it's address space. Physical memory is allocated by committing those reserved pages. Of course, even then you are not necessarily using that memory, because committed pages can be swapped out to the page file, temporarily releasing the underlying physical memory.

In short, this isn't something you (generally) need to worry about. What is the problem you are trying to solve?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »