How much RAM used by Python dict or list?

Posted by Who8MyLunch on Stack Overflow See other posts from Stack Overflow or by Who8MyLunch
Published on 2010-06-09T20:29:11Z Indexed on 2010/06/09 20:32 UTC
Read the original article Hit count: 165

Filed under:
|
|
|
|

My problem: I am writing a simple Python tool to help me visualize my data as a function of many parameters. Each change in parameters involves a non-trivial amount of time, so I would like to cache each step's resulting imagery and supporting data in a dictionary. But then I worry that this dictionary could grow too large over time. Most of my data is in the form of Numpy arrays.

My question: How would one go about computing the total number of bytes used by a Python dictionary. The dictionary itself may contain lists and other dictionaries, each of which contain data stored in Numpy arrays.

Ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about memory