Workaround for psutil API change

This commit is contained in:
Kovid Goyal 2015-06-27 00:18:32 +05:30
parent 8169af0cdc
commit 8b777eb1d4

View File

@ -21,7 +21,10 @@ def get_memory():
'Return memory usage in bytes'
import psutil
p = psutil.Process(os.getpid())
mem = p.get_ext_memory_info()
if hasattr(p, 'memory_info_ex'):
mem = p.memory_info_ex()
else:
mem = p.get_ext_memory_info()
attr = 'wset' if iswindows else 'data' if islinux else 'rss'
return getattr(mem, attr)