[Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)
Kristján Valur Jónsson
kristjan at ccpgames.com
Thu Apr 26 15:26:47 CEST 2012
> -----Original Message-----
> From: "Martin v. Löwis" [mailto:martin at v.loewis.de]
> 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())
> end = pympler.muppy.get_size(pympler.muppy.get_objects())
> print "delta mem: %d" % (end-start)
Thanks for pointing out pympler to me. Sounds like fun, I'll try it out.
I should point out that gc.get_objects() also works, if you don't care about stuff like ints and floats.
Another reason why I like the runtime stats we have built in, however, is that they provide no query overhead.
You can query the current resource usage as often as you like and this is important in a running app. We log python memory usage every second or so.
More information about the Python-Dev