[Python-Dev] iterzip()

Tim Peters tim.one@comcast.net
Mon, 29 Apr 2002 18:17:37 -0400

[Guido, on adjusting gc threshold up or down depending on how much
 garbage each gc pass finds]

> Should we worry about programs that don't create any cyclical garbage
> for a long time, and then suddenly start creating lots of it?  The
> initial GC-free period may bump the threshold up very far, and then it
> will build up a significant pile of cyclical garbage before GC runs
> again.

Yes, when the past is a rotten predictor of the future, it's hard to predict
the future better than rottenly.  Countless megabytes of cyclic structures
may be kept alive by a single reference too, so looking for a bump in
deallocation rate isn't a cure-all either.

A practical compromise would be to allow thresholds to auto-adjust, but only
within a fixed range.  That would give Neil the opportunity to add more
tuning knobs nobody understands <wink>.  I'd set the default upper bound
pretty high, like a few million excess allocations.  Somebody creating
oodles of cyclic trash after a long quiet period, *and* who can't afford to
let the memory go unreclaimed, would have to learn to import gc and force
the issue.  The rest of us would enjoy less gc overhead with little
potential for harm.

I'd also do auto-adjust by more than 25%; *2 and /2 are more like it.
Programs don't *ease* their way into different memory behaviors, when it
changes it's likely to be a sharp break.