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

Tim Peters tim.one@comcast.net
Tue, 06 May 2003 11:47:46 -0400


[M.-A. Lemburg]
> If someone really care, I suppose that the garbage collector could
> do an occasional scan of the int free list and chop of the tail
> after a certain number of entries.

Int objects aren't allocated individually; malloc() is used to get single
"int blocks", which contain room for about 1000 ints at a time, and these
blocks are carved up internally by intobject.c.  So it isn't possible to
reclaim the space for a single int, so "tail" doesn't mean anything useful
in this context.

> FWIW, Unicode free lists have a cap to limit the number of entries
> in the list to 1024.

The Unicode freelist is more like the frameobject freelist that way (it is
possible to reclaim the space for an individual Unicode string or frame
object).