I need help using Pympler and getting the memory usage of an object. I am using it like this:
from pympler import classtracker
myObj = SomeClass()
tr = classtracker.ClassTracker()
tr.track_object(myObj)
# Do stuff with object here
# Print stats
tr.create_snapshot()
tr.stats.print_summary()
This works fine and I get these results:
---- SUMMARY ------------------------------------------------------------------
active 0 B average pct
SomeClass 1 136.45 KB 136.45 KB 0%
-------------------------------------------------------------------------------
My question is how do I get the average number and put it in a variable? I can't find anything in the documentation. I'm running some tests and want to get the average over the lifetime of the tests. If you know of a way to do that or if there is any other package I can use to accomplish what I want, please let me know. Thank you.