Windows - Commit Size vs Virtual Size

前端 未结 3 2046
猫巷女王i
猫巷女王i 2020-12-13 02:12

i would like to know the exact difference between Commit Size (visible in the Task Manager) and Virtual Size (visible in SysIntern

3条回答
  •  醉梦人生
    2020-12-13 02:48

    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.

提交回复
热议问题