Skip to content

Instantly share code, notes, and snippets.

@arjoly
Created September 7, 2012 12:19
Show Gist options
  • Save arjoly/3665731 to your computer and use it in GitHub Desktop.
Save arjoly/3665731 to your computer and use it in GitHub Desktop.
Truncation issue in _get_memory
import psutil
import os
import memory_profiler
pid = os.getpid()
a = memory_profiler._get_memory(pid)
process = psutil.Process(pid)
b = float(process.get_memory_info()[0]) / (1024 ** 2)
print a
#>>> 5.0
print b
#>>> 5.66015625
print a == b
#>>> False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment