[Reprint]windows Task Manager working set memory, memory dedicated working set, commit size in detail

Source: Internet
Author: User

Working set memory, memory dedicated working set, commit size in detail in Windows Task Manager

Http://shashanzhao.com/archives/832.html

Although it is the Chinese text, but it is still difficult to understand, what is called the work set memory , what is called the memory dedicated working set , what is called the size of the commit , the difference is what, let people look at the confused.

Popular speaking work setting up memory is the physical memory that is used by the program (which is part of the share with other programs), the memory dedicated working set is the program exclusive physical memory , the commit size is the program exclusive Memory (contains physical memory and memory in the paging file).

Note: The paging file is the memory that is not in physical memory, the file path is generally in C:\pagefile.sys, the purpose is to allow more processes to run, even if the memory used to take up more than the physical memory. As soon as a portion of the memory is transferred to the paging file, the physical memory can be vacated to continue running the new process.

The relationship between them:

Work Set memory = Dedicated working set of memory + physical memory shared with other processes.

Commit size = Memory Dedicated working Set + exclusive memory saved in the paging file.

(with some exceptions, sometimes the memory-dedicated working set may be a little bit larger than the commit size, but it doesn't have to be considered)

Working set memory and memory dedicated working set changes when the program does not change, the system takes into account program activity, physical memory remaining amount, etc. to reduce or increase physical memory.

The commit size does not change when the program does not change, because the program consumes so much dedicated memory.

If you want to test the memory size of your program, it is recommended that you log the commit size after the program has finished loading. Other changes suggested do not record.

—————————————————————————————————————————————————————————————————————

Want to know more about it, good boy.

The following is a detailed understanding of the code. First, the Windows Task Manager is not enough, you need to use Process Explorer and the Vmmap tool, and then explain some nouns:

Title in Windows Task Manager The appellation in Process Explorer The appellation in Vmmap
Working Set Memory Working Set Total WS
Dedicated working set of memory WS Private Private WS
Commit Size Private Bytes Private
No corresponding option to display Virtual Size Size
No corresponding option to display No corresponding option to display Committed

Noun Description:

Virtual Size: The total memory used by the program (contains shared, unshared, physical, page, reserved but unallocated memory for the program)

Committed:virtual size minus the memory reserved for the program but not allocated

Reserved but unallocated memory for the program: just tell the system I want a piece of memory, but temporarily not, but the assigned address to me, the system will give him an address, but do not allocate memory, and so on when the application to use, from the page or physical memory allocated to the address.

About the paging file and physical memory how to convert a little bit, when the program to access an address, the system found that the address is not in physical memory, it will be interrupted, and then go to read the paging file, the paging file in the memory-related data copied to the physical memory, and then marked that the address is already in physical memory, Then continue to let the program run.

Let's look at an example:

Program Main.exe defines a 5M global variable, 5M constant, and requests a 5M of memory, the program code size is 2M.

Char g_str[5*1024*1024];

const Char str[5*1024*1024];

void Main ()

{

Char *p = (char*) HeapAlloc (GetProcessHeap (), 0, 1024*1024*5);

Call_lib ();

}

Program Lib.dll defines a 4M global variable, 4M constant, and requests a 4M of memory, the program code size is 1M.

Char g_str[4*1024*1024];

const Char str[4*1024*1024];

void Call_lib ()

{

Char *p = (char*) HeapAlloc (GetProcessHeap (), 0, 1024*1024*4);

}

the Main.exe program called Lib.dll, First look at the total memory occupied by Main.exe.

Virtual Size = 5M global variable + 5M constant + 5M memory + 2M program code + 4M Global variables + 4M constants + 4M of Memory + 1M program code = 30M.

Then look at the Main.exe exclusive memory:

Private Bytes = 5M global variable + 5M of memory + 4M of constant + 4M of memory =18m.

It can be seen that the monopoly refers to the process itself, such as code, constants and so on is shared.

allocated memory, a mutable global or static variable is exclusive. as for working set and WS Private, the value cannot be computed because it is a variable.

Working Set physical memory change rule:

In general, after allocating memory, the physical memory is allocated only about 4K, and so on when the access to more than 4K, will slowly increase the physical memory, until the total physical memory of the system is less than a certain value, will not be in the foreground of the process's physical memory reduced.

If the process wants to rest, it can call SetProcessWorkingSetSize (GetCurrentProcess (),-1,-1);

To transfer some of their memory from physical memory to the paging file.

Test environment: Win7 32-bit

Reference:

Vmmap display is not the same as the Process Explorer

Http://superuser.com/questions/185318/process-explorer-not-showing-the-biggest-user-of-my-ram

Vmmap Memory Explanation

Http://www.cnblogs.com/georgepei/archive/2012/03/07/2383548.html

you may reprint this article, but do not delete the author information when reproduced.
HGYXBLL, original link:http://shashanzhao.com/archives/832.html Tags:CommittedPrivate private Bytes  private WS  total WS  virtual Size  working set  ws Private   Task Manager   dedicated working set of memory   working settings   commit size

[Reprint]windows Task Manager working set memory, memory dedicated working set, commit size detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.