Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
620 views
in Technique[技术] by (71.8m points)

memory - Windows - Commit Size vs Virtual Size

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...