.net, what determines the size of a private byte

Confused by private bytes!

The memory usage of our C # .NET application with the ANTS profiler is currently being analyzed. Here are our conclusions made after launch, with the main form visible on the screen. Other functions were not used.

General 0 Heap - 5.8MB
Gen 1 Heap - 2.5MB
Gen 2 Heap - 13.9MB
Bytes in all heaps - 17 MB
Big pile of objects - 0.7MB
Private Bytes - 130 MB
Work Set - 150 MB

If the bytes in all heaps are only 17 MB, why do we have such a large allocation of bytes? Are private bytes allocated by the system, or are private bytes starting from scratch when they are populated by software? that is, it is a private byte that can be partially used only partially. If so, what determines its size?

+4
source share
2 answers

Private bytes are all virtual distributions of a process that cannot be transferred to other processes (i.e. exclude files with code and memory mapping). This will include all NT (native) Heaps, any managed heaps, stacks, and any memory explicitly allocated by the application ( VirtualAlocEx ).

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

0
source

From Red-Gate: Overview of Private Bytes

Private bytes include free space on heap .NET, as well as the use of unmanaged memory.

+1
source

All Articles