Turn off cycle detection at runtime?

François Pinard pinard at iro.umontreal.ca
Fri Dec 27 11:44:45 EST 2002


[Jive Dadson]

> Aahz wrote:
> > gc.disable() or gc.set_threshold(0).

> Thanks.  I had seen those, but I pesumed they pertained to garbage
> collection in general rather than cycle detection.

There is a slight confusion when we speak of garbage collection in Python,
because there are two somewhat independent mechanisms.  The traditional
device is based on reference counting and collection happens synchronously
with the last reference being cut, while the more recent collector is from
the mark-and-sweep brand and collection happens in a deferred way.  When we
say "garbage collection" in Python, we often refer to the latest device more
than the traditional one, and so does the `gc' module.

This Python garbage collector is only there to handle reference cycles.
Without cycles, the reference counting based collection does it all already.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list