File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -268,11 +268,15 @@ def virtual_percent() -> float:
268268
269269 @staticmethod
270270 def virtual_used () -> int : # In bytes
271- return psutil .virtual_memory ().used
271+ # Do not use psutil.virtual_memory().used: from https://psutil.readthedocs.io/en/latest/#memory
272+ # "It is calculated differently depending on the platform and designed for informational purposes only"
273+ return psutil .virtual_memory ().total - psutil .virtual_memory ().available
272274
273275 @staticmethod
274276 def virtual_free () -> int : # In bytes
275- return psutil .virtual_memory ().free
277+ # Do not use psutil.virtual_memory().free: from https://psutil.readthedocs.io/en/latest/#memory
278+ # "note that this doesn’t reflect the actual memory available (use available instead)."
279+ return psutil .virtual_memory ().available
276280
277281
278282class Disk (sensors .Disk ):
You can’t perform that action at this time.
0 commit comments