简体   繁体   中英

.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?

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM