.net memory usage, what determines private byte size

Confused by private bytes!

Currently analysing the memory usage of our C# .NET application with ANTS profiler. Here are our findings taken after start-up with the main form visible on screen. No other functionality has been used.

Gen 0 Heap - 5.8MB
Gen 1 Heap - 2.5MB
Gen 2 Heap - 13.9MB
Bytes in all Heaps - 17MB
Large Object Heap - 0.7MB
Private Bytes - 130MB
Working Set - 150MB

If the bytes in all heaps is only 17MB why do we have such a large private bytes allocation? Are private bytes allocated by the system or does private bytes start at zero expanded as it get's filled by the software? ie is private bytes a bubble which may in fact only be partially used? If so, what determines it's size?


Private bytes are all the virtual allocations of a process that cannot be shared with other processes (ie. excludes code and memory mapped files). This will include all NT (native) Heaps, any managed Heap, stacks and any memory explictly allocated by applicatio (VirtualAlocEx).

You can use !dumpheap -stat to get a detailed usage of your CLR memory usage. See CLR Memory Leak


From Red-Gate: General information about "Private Bytes"

Private bytes includes free space on the .NET heaps as well as unmanaged memory usage.

链接地址: http://www.djcxy.com/p/80182.html

上一篇: Perfmon计数器来检查内存泄漏

下一篇: .net内存使用情况,什么决定了私有字节的大小