[Python-ideas] python-like garbage collector & workaround

castironpi-ng at comcast.net castironpi-ng at comcast.net
Sat Mar 28 23:04:28 CET 2009

I am writing a garbage collector that is similar to Python's.  I want to know what you think, what problems I may encounter, and what kind of value I'm looking at.

For my review of literature, I have read excerpts from, and stepped through, Python's GC.  I'm picturing it as a specialized breadth-first search.

I am concerned by the inability to call user-defined finalization methods.  I'm considering a workaround that performs GC in two steps.  First, it requests the objects to drop their references that participate in the cycle.  Then, it enqueues the decref'ed object for an unnested destruction.

Here is a proof-of-concept implementation.


More information about the Python-ideas mailing list