VirtualMemorySize measures all the virtual memory used by your process. Which includes pages shared by all other processes on your computer. Which in the .NET program includes the operating system, CLR, jitter, and ngen-ed Framework builds.
Diagnostic tools . Displays a live graph of your applications. Private bytes. Private bytes are a measure of the total amount of memory that has been allocated by a process, not including the memory shared by other processes.
In the Task Manager, by default you see the memory of the "private working set", which is the amount of memory used by a process that cannot be shared with other processes.
So:
If you want to get an idea of โโhow much memory you are using, retrieve VirtualMemorySize , Working Set, and Private Bytes for the process.
- A private byte is the same thing that the task manager is misleading as "Virtual Machine Size".
- A working set is what the task manager calls โMem Usage,โ which is part of the address space of processes (โPrivate Bytesโ plus memory-mapped files) that are currently in RAM and can be referenced without a page error).
- VirtualMemorySize is a shared virtual address space for a process that includes both private bytes and memory mapped files.
If you add all the VirtualMemorySize processes, you are more likely to find more memory in it than you actually are. This is because these files are memory mapped, exe, dll, etc. Can be shared between processes; and the same physical page in RAM can be obtained simultaneously in several address spaces of the process.
source share