What are these different kinds of memory usage in Windows 7 task manager?

In Windows 7’s task manager, I can select different columns to show. There are a bunch that are related to memory and memory usage, but I’m not sure what it all means.

I have a Dutch installation of Windows, so I’ll try to translate them; as I’m not sure of the English names.

Memory columns

In order:

  • Working set
  • Peak working set
  • Private working set
  • Commit charge
  • Paged pool
  • Not-paged pool

Solution:

What is a working set and what is it used for?

A working set is a subset of virtual pages resident in physical memory.

There are multiple kinds of working sets in Windows:

  • Process working sets contain the pages referenced by threads within a single process.

  • The System working set contains the resident subset of the pageable system code (this mostly includes the kernel and loaded drivers), among the paged pool and the system cache.

  • Session working sets that contain resident subsets of kernel-mode session-specific data allocated by the Windows subsystem, session paged pool, session mapped views and other session drivers.

In essence, a working set is used to decide how much physical memory can be used to avoid a lot of paging. When a page fault occurs, the limits of the working set and the amount of free memory on the system are examined. If necessary, the memory manager allows a process to grow to its working set maximum. If memory is tight, Windows will replace pages in a working set when a page fault occurs.

Windows will attempt to keep memory available by writing modified pages to disk. If the memory runs low, the working set manager will try to trim most working sets to increase the amount of available physical RAM memory available to the system. Processes that have a bigger amount of pages have a higher tendency to be looked at.

The default working set for a process consist of a minimum of 50 pages and has a maximum up to 345 pages. Limits can be changed but the defaults will suffice in most use cases, one also has to note that the maximum working set size can’t exceed the system-wide maximum calculated at boot time.

Windows reports the total, peak and private amounts of physical RAM used by the virtual working set pages for a process. Private indicates memory that isn’t shared amongs processes.

What is commit charge and what is it used for?

Pages in the virtual address space of a process are free, reserved, or committed. Applications can reserve address space and then commit to it; reserving itself doesn’t take memory or page file space, it is mainly done to reduce the memory by deferring page commitments.

Committed pages are pages that, when accessed, ultimately translate to valid pages in physical memory; they are either private and to shareable or mapped to a view of a section. A section can either be Shared Memory or Mapped Files; so, If committed pages are mapped to a portion of a mapped file, they might need to be brought in from disk when accessed.

The most common known mapped file is the Page File. It stores modified pages that are still in use by some process but have had to be written to disk. By doing this more aggresively, the memory can more easily be emptied without having to do I/O writes prior to that.

The memory manager keeps track of private commit charge on a global basis, and on a per-process basis as the page file quota. These values are then used to determine how often to write to the page file. Please note that freeing memory is done by the working set mechanism…

When something is no longer in memory, it is loaded in from the page file.

Windows reports commit charge as the total amount of memory a process uses for which there is no backing store; it essentially sums up the amounts of physical RAM that is still absent in the page file and subtracts other mapped files from that.

A backing store is storage that has a back-up of the data; for example, if you map an image into memory then the image would be in both memory and on your disk; so, it makes no sense to calculate that image as memory usage given that you can always access it from disk when necessary in high memory conditions.

What are memory heaps and what are they used for?

Known as the paged and the non-paged pool…

System threads from the kernel don’t have an address space like processes do; hence, they must allocate any dynamic storage in the memory heaps of the operating system, this is mostly formed by the paged or non-paged pool.

Paged pool consists of virtual memory that can be paged into and out of the system. Device drivers that don’t need to access the memory at a low dispatch level (a higher priority) can freely use the paged pools.

Non-paged pool consists of virtual memory that is guaranteed to reside in physical memory at all times and thus can be accessed at any time without incurring a page fault. Device drivers that must access memory at a lower dispatch level MUST use the non-paged pool to ensure that the data can be accessed as I/O calls are unavailable at that point, there is mainly critical code at this level anyway…

These pools have a minimum and maximum size, these are determined to be a small procent of the available RAM. While they can grow, please note that they will not exceed a certain precent of the available RAM. While the non-paged pool is quite solid given that it’s only for the more critical memory, the paged pool will extend into the page file.

This is one of the most overseen problems when people disable their page file. Among other stability and performance problems, which are sure worth checking out if you have disabled the page file.

Source: Extracts from the Windows Internals book rewritten into an understandable text.