mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Workaround for psutil API change
This commit is contained in:
parent
8169af0cdc
commit
8b777eb1d4
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user