I am trying to list and sort all running processes in Windows by their memory consumption with the python psutil module. However when I query a processes memory_info
attribute none of the various metrics will get above 4 gigabytes. Why is this limited and how can I get around this?
I did try using proc.memory_full_info()
which would theoretically fix this issue with the uss
memory metric, however I cannot figure out how to do this without causing an AccessDenied error.
sample script:
import psutil
from psutil._common import bytes2human
procs = [p.info for p in psutil.process_iter(attrs=['memory_info', 'memory_percent', 'name'])]
for proc in sorted(procs, key=lambda p: p['memory_percent'], reverse=True):
print("{} - {}".format(proc['name'], bytes2human(getattr(proc['memory_info'], 'rss'))))
I'm open to any other way of profiling memory usage, psutil just seems to be the best tool I found out there.