Embedding Python: estimate size of dict/list

Michael Hunter tahoemph at gmail.com
Mon Mar 28 21:28:53 EDT 2011


On Mon, Mar 28, 2011 at 4:18 PM, Chris Angelico <rosuav at gmail.com> wrote:
[...]
> Obviously I could use PyObject_Str() and PyString_Size() to get a
> decent figure, but that seems like overkill.
>
> What I'm hoping for is some simple function that zips through a
> complex object and sums its approximate memory usage. Is there one?
[...]

Check out David Malcom's video on memory usage from PyCon 2011 at
http://blip.tv/file/4878749

There isn't a direct answer to your question but you might check out
the tools he has built as a step in that direction.

                 Michael



More information about the Python-list mailing list