Windows - Commit Size vs Virtual Size

Faris Zacina picture Faris Zacina · Mar 4, 2014 · Viewed 36.1k times · Source

i would like to know the exact difference between Commit Size (visible in the Task Manager) and Virtual Size (visible in SysInternals' Process Explorer).

The Virtual Size parameter in Process Explorer looks like a more accurate indicator of Total Virtual Memory usage by a process. However the Commit Size is always smaller than the Virtual Size and I guess it does not include all virtual memory in use by the process. I would like somebody to explain what is exactly included in these parameters.

Answer

Damon picture Damon · Mar 4, 2014

Memory can be reserved, committed, first accessed, and be part of the working set. When memory is reserved, a portion of address space is set aside, nothing else happens.

When memory is committed, the operating system guarantees that the corresponding pages could in principle exist either in physical RAM or on the page file. In other words, it counts toward its hard limit of total available pages on the system, and it formally creates pages. That is, it creates pages and pretends that they exist (when in reality they don't exist yet).

When memory is accessed for the first time, the pages that formally exist are created so they truly exist. Either a zero page is supplied to the process, or data is read into a page from a mapping. The page is moved into the working set of the process (but will not necessarily remain in there forever).

Every running process has a number of pages which are factually and logically in RAM, that is these pages exist, and they exist "officially", too. This is the process' working set.
Further, every running process has pages that are factually in RAM, but do not officially exist in RAM any more. They may be on what's called the "standby list" or part of the buffer cache, or something different. When these are accessed, the OS may simply move them into the working set again.
Lastly, every process has pages that are not in RAM at all (either on swap or they don't exist yet).

Virtual size comprises the size of all pages that the process has reserved.

Commit size only comprises pages that have been committed.

That is, in layman terms, "virtual size" is pretty much your own problem, and only limited by the size of your address space, whereas "commit size" is everybody's problem since it consumes a global limited resource (RAM plus swap). It therefore affects other processes.