[Python-Dev] C API for gc.enable() and gc.disable()

"Martin v. Löwis" martin at v.loewis.de
Mon Jun 23 05:39:06 CEST 2008

> pymalloc needing to allocate a new arena would be a different way to
> track an excess of allocations over deallocations, and in some ways
> more sensible (since it would reflect an excess of /bytes/ allocated
> over bytes freed, rather than an excess in the counts of objects
> allocated-over-freed regardless of their sizes -- an implication is,
> e.g., that cyclic gc would be triggered much less frequently by mass
> creation of small tuples than of small dicts, since a small tuple
> consumes much less memory than a small dict).
> Etc. ;-)

:-) So my question still is: how exactly?

Currently, only youngest collections are triggered by allocation
rate; middle and old are triggered by frequency of youngest collection.
So would you now specify that the youngest collection should occur
if-and-only-if a new arena is allocated? Or discount arenas returned
from arenas allocated? Or apply this to triggering other generation
collections but youngest? How would that help the quadratic behavior
(which really needs to apply a factor somewhere)?


More information about the Python-Dev mailing list