Memory sizes of python objects?

Peter Hansen peter at engcorp.com
Sun Mar 24 12:02:24 EST 2002


Erno Kuusela wrote:
> 
> In article <mailman.1016923416.31517.python-list at python.org>, "Clark C
> . Evans" <cce at clarkevans.com> writes:
> 
> | Is there some rule of thumb that I can use to estimate,
> | for example, take the character data you have and multiply by
> | a factor of 4 to find the in-memory footprint of tuples, and
> | each map is 1K plus 64 bytes per entry..
> 
> make a zillion of them, check memory usage increase with ps (or
> equivalent on your platform), and divide by zillion.

Keeping in mind Python's propensity for finding already-existing
entities and binding to them instead of creating new objects.

The difference in memory consumption between creating a list 
of size 1,000,000 filled with 0's and the same size list filled 
with integers from 0 to 999,999 is rather large...

-Peter



More information about the Python-list mailing list