Python dictionary size/entry limit?

"Martin v. Löwis" martin at v.loewis.de
Sun Feb 22 15:11:41 EST 2009


intelliminer at gmail.com wrote:
> Is there a limit to the size or number of entries that a single 
> dictionary can possess?

On a 32-bit system, the dictionary can have up to 2**31 slots,
meaning that the maximum number of keys is slightly smaller
(about 2**30).

As others have pointed out, Python's or Windows' memory management
might have led to fragmentation, so that no contiguous piece of
memory to hold the resized dictionary can be found.

One solution to that problem would be to use a 64-bit system.

Regards,
Martin




More information about the Python-list mailing list