Reputation: 2110
My objective is simply to list the top 5 processes hogging memory, and exactly how much memory they are "using". I have read through the docs and it seems that process.memory_info().rss
is what I want, however this number comes out significantly smaller than what the windows task manager is telling me is in the 'Private Working Set'.
Even when I list out the whole contents of memory_info
none of the values even come close to the task manager values.
I realize from reading articles by Giampalo that this is a complex topic, and I know very little about system memory. However the simplicity of what I need is to get a number out of psutil which matches the windows task manager (I don't need all of the other metics). How can I get/calculate this?
EXAMPLE
from pprint import pprint as pp
import psutil
procs = [(proc.info['name'], proc.info['memory_full_info']) for proc in psutil.process_iter(attrs=['name', 'memory_full_info'])]
pp(procs)
Gives me the following data for "AfterFX.exe":
('AfterFX.exe', pfullmem(rss=4294967295L, vms=4294967295L, num_page_faults=42058243, peak_wset=4294967295L, wset=4294967295L, peak_paged_pool=2791656, paged_pool=2657304, peak_nonpaged_pool=13270384, nonpaged_pool=13147944, pagefile=4294967295L, peak_pagefile=4294967295L, private=4294967295L, uss=376668160L)),
Yet task manager gives me: AfterFX.exe 50,561,764 K
Upvotes: 2
Views: 2548
Reputation: 13056
I am writing from my phone so I can’t link you the specific doc but memory_full_info().uss should be what you are looking for.
Upvotes: 2