7

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?

Joe
  • 122,218
  • 32
  • 205
  • 338

2 Answers2

3

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.

plodoc
  • 2,783
  • 17
  • 17
  • Interesting. If you have a MSDN account it would be good if you could at this information. – Bobby Oct 11 '11 at 17:10
1

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.

Bobby
  • 11,419
  • 5
  • 44
  • 69
  • About your last sentence: There are numerous examples - none of which I can recall right now - that shows that the MSDN indeed has errors. So, if you observe something that contradicts the MSDN, changes are high, that the MSDN has an error in it and not that your observation is wrong. – Daniel Hilgarth Sep 12 '11 at 17:11
  • When I add the columns Min Working Set and Max Working Set in Process Explorer on a Windows 2008 R2, I see that all process except dwm.exe (Desktop Windows Manager has increased its values) have the same values 200Kb and 1300 Kb, that are also seen by Joe. – plodoc Oct 12 '11 at 08:26