[Python-Dev] Int FutureWarnings and other 2.4 TODOs

Tim Peters tim.one at comcast.net
Fri Dec 5 12:12:38 EST 2003

> ...
> So when you do range(10000000), and that list goes away, most of the
> space for the int objects it held ends up in millions of int objects
> pushed onto the int freelist.  They all stay there until the program
> shuts down (although they get reused to satisfy requests for new int
> objects).

BTW, using pymalloc instead wouldn't eliminate that allocated memory is
never returned to the OS.  pymalloc grabs large "arenas" from malloc(), and
never free()s them.  The fundamental difference is that pymalloc is
type-agnostic:  space gotten from pymalloc for, say, a dict, can later be
reused for, say, a string.  pymalloc's freelists are segregated by raw
memory size rather than by type, and a given chunk of pymalloc memory may
even move from one size list to another (any number of times).

More information about the Python-Dev mailing list