Real Problems with Python

Steve Holden sholden at bellatlantic.net
Tue Feb 15 17:57:42 EST 2000


Alan Daniels wrote:
> 
> [summarises GC position]
> 
> 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

I seem to remember this was essentially the scheme used by Robert Dewar
in the Spitbol implementation of Snobol4 (I know, I'm showing my age: I
ported from the 1900 series to the DECSystem-10 as my final-year
undergraduate product).  He did this precisely to be able to reclaim
memory from unreferenced cyclic structures.

Spitbol also allowed explicit calls to the GC, which would return
the amount of memort reclaimed, presumably for want of a more sensible
result.

However, this method may be slower than the existing collector.

regards
 Steve

regards
 Steve
--
"If computing ever stops being fun, I'll stop doing it"



More information about the Python-list mailing list