Real Problems with Python

Alan Daniels daniels at mindspring.com
Mon Feb 14 20:24:08 EST 2000


On 14 Feb 2000 17:33:13 +0100, the infinitely wise Martin von Loewis
(loewis at informatik.hu-berlin.de) spoke forth to us, saying...

>Indeed. I think Tim's right here (as always:); if the request for
>garbage collection is rephrased as 'reclaim cycles', everybody will be
>happy.

Okay, I'm going to go out on a limb here and demonstrate my lack of
knowledge on subtle language issues like this one, but here goes: The
debate seems to come down between reference counting (which collects
items immediately, but can lose objects due to cyclical references)
and Java-style garbage collection for lack of a better phrase (which
reclaims *all* objects, but does it in its own sweet time).

My question is: How hard would it be to keep the reference counting,
but add a built-in function, maybe called "gc()", that would walk
through all the existing objects, find the ones that have been
orphaned due to cyclical references, and reclaim them? Would something
like that be enough to make everybody happy? Possibly implemented as a
patch so that it was optional? It would still be deterministic (in
that __del__ would always get called right away, when appropriate),
but would still make sure that no objects were ever left unreclaimed
indefinitely.

Would that work, or no?

-- 
=======================
Alan Daniels
daniels at mindspring.com
daniels at cc.gatech.edu



More information about the Python-list mailing list