Private/Virtual Memory and Working Set

This section describes 3 basic memory usage numbers of a running process: private memory, virtual memory and working set.

From the previous tutorial, we learned how to retrieve memory usage statics using methods and properties of the System.Diagnostics.Process class. Now let's try to understand first 3 memory usage numbers:

"Private Memory", returned by the "PrivateMemorySize64" property, representing the amount of RAM allocated privately to the process. In general, "Private memory" does not include any memory occupied by shared DLL files used by the process.

"Virtual Memory", returned by the "VirtualMemorySize64" property, representing the total virtual address space of the process.

"Working Set", returned by the "WorkingSet64" property, representing the portion of the "Virtual memory" that is currently resident in RAM and can be reference without a page fault.

Run the MemoryUsage.exe created from the previous example again, you will see:

Current process: System.Diagnostics.Process (MemoryUsage)
Private Memory: 8744960
Virtual Memory: 89157632
Working Set: 5599232
Paged Memory: 8744960
Paged System Memory: 100228
Non-paged System Memory: 3988

Now we know how read those numbers:

Table of Contents

 About This Book

 Introduction of C# (C Sharp)

 Data Type and Variables

 Logical Expressions and Conditional Statements

 Arrays and Loop Statements

 Data Type Features

 Floating-Point Data Types

 Passing Parameters to Methods

 Execution Environment Class

 Visual C# 2010 Express Edition

 Class Features

 C# Compiler and Intermediate Language

 Compiling C# Source Code Files

 MSBuild - Microsoft Build Engine

Memory Usages of Processes

 Using "Process" Class to Show Memory Usages

Private/Virtual Memory and Working Set

 Footprints of Private and Shared Memories

 Virtual Memory Upper Limit

 Memory Report from Windows Task Manager

 Memory Report from Performance Console

 Multithreading in C#

 Async Feature from C# 5

 System.IO.FileInfo Class

 System.Diagnostics.FileVersionInfo Class

 WPF - Windows Presentation Foundation

 Partial Classes and Partial Methods

 Archived Tutorials

 References

 Full Version in PDF/ePUB