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?
My program has 7,667,712 bytes of committed heap, yet it has 33,546,240 reserved heap
Share
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.