Memory sizes of python objects?
Erno Kuusela
erno-news at erno.iki.fi
Sun Mar 24 13:24:35 EST 2002
In article <3C9E06A0.EC4D51E3 at engcorp.com>, Peter Hansen
<peter at engcorp.com> writes:
| 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...
you make it sound more mysterious than it is - only numbers under
100 and identifier-like string literals get interned, afaik.
-- erno
More information about the Python-list
mailing list