Is there a formula for determining the approximate size of a dictionary (minus its data) under 32 and 64 bit Python with a specific average key size?
For instance, if we were running a 64-bit version of Python and created a dictionary of 1 million items with an average key length of 48 bytes, is there a way to calculate how much memory this type of dictionary would consume on average? I understand that there will be overhead for the amount of information that each dictionary entry holds - I'm just trying to get a handle on how much memory a given dictionary's basic structure will require. My understanding is that Python stores both the hash value of the key and the key itself plus 2 pointers: a key pointer and a value pointer. I'm guessing that dictionary keys are stored as either 4 or 8 byte values. So my back of the napkin estimate is that there each dictionary entry under a 64 bit version of Python would be 24 bytes + the original key. Malcolm -- http://mail.python.org/mailman/listinfo/python-list