Benchmarks should measure memory usage too, of course.  Sadly that is
not possible in standard cPython.

It's actually very easy in standard CPython, using sys.getsizeof.

Yes, you can query each python object about how big it thinks it is.
What I'm speaking of is more like:
start_allocs, start_mem = allocator.get_current()
allocator.reset_limits()
run_complicated_tests()

end_allocs, end_mem = allocator.get=current()

This is easy in a debug build, using sys.getobjects(). In a release build, you can use pympler:

start = pympler.muppy.get_size(pympler.muppy.get_objects())
run_complicated_tests()
end = pympler.muppy.get_size(pympler.muppy.get_objects())
print "delta mem: %d" % (end-start)

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to