Why does Process.PrivateMemorySize64 /1024
not match what Windows Task Manager Memory (Private Working Set)?
There seems to be a big (~ 30%) difference. Plus the value doesn't update frequently like task manager.
Calling _process.Refresh()
doesn't help.
You are looking at different things.
The PrivateMemorySize64
property from the Process class is the equivalent of the Private Bytes performance counter. It represents the total amount of private memory allocated for the associated process that cannot be shared with other processes. Private bytes are not only physical memory, but also paged files etc.
On the other end the Private Working Set tracks a subset of the private bytes above, which represents only the physical memory that a process is using and can't be shared with other processes.