Why is Process.WorkingSet > Process.MaxWorkingSet?

梦想与她 提交于 2019-12-09 07:05:03

问题


Idle curiosity...

I'm looking at some of the properties of the current process:

using(Process p = Process.GetCurrentProcess())
{
    // Inspect properties
    // p.MaxWorkingSet = 1,413,120
    // p.MinWorkingSet = 204,800
    // p.WorkingSet = 54,140,928
    // p.WorkingSet64 = 54,140,928
}

From my reading of the documentation, these properties are all related to the working set size in bytes, hence I was expecting to see:

MinWorkingSet <= WorkingSet <= MaxWorkingSet

This is not the case, can anyone explain why?


回答1:


MaxWorkingSet and MinWorkingSet are the values returned by the Win32 API GetProcessWorkingSetSize. These are limits used by the virtual manager that will be enforced when the memory is in short supply. As long as enough memory is available, the current working set size is allowed to grow larger than the value in MaxWorkingSet.




回答2:


While the MSDN is not really helpful in this case, a small investigation with the Process Explorer on the other hand revealed that the values for Private Memory/MaxWorkingSet and Shared Memory/WorkingSet do nearly exactly match.

Which makes me believe (yes, I do lack hard evidence) that the MaxWorkingSet does display the private memory while the WorkingSet64 does display the complete memory, including shared one.

I know what the MSDN says...and I don't care, I see something different in the Process Explorer.



来源:https://stackoverflow.com/questions/7387055/why-is-process-workingset-process-maxworkingset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!