Where'd my memory go? (was Re: [Python-Dev] Dictionary sparseness) (original) (raw)

Skip Montanaro skip@pobox.com
Mon, 5 May 2003 15:24:39 -0500


Tim> Stuff all these things miss (even pymalloc, because it isn't asked
Tim> for the memory) include the immortal and unbounded int freelist,
Tim> the I&U float FL, and the immortal but bounded frameobject FL.  Do,
Tim> e.g., range(2000000) (as someone did on c.l.py last week), and
Tim> about 24MB "goes missing" until the program shuts down (it's
Tim> sitting in the int FL).  Note that pymalloc never returns its
Tim> "arenas" to the system either.

These shortcomings could be remedied by suitable inspection functions added to sys for debug builds.

This leads me to wonder, has anyone measured the cost of deleting the int and float free lists when pymalloc is enabled? I wonder how unbearable it would be.

Skip