A couple garbage collector questions

David Allen mda at idatar.com
Mon Apr 2 19:51:30 EDT 2001


In article <lclmpj543v.fsf at gaffa.mit.edu>, "Douglas Alan" <nessus at mit.edu>
wrote:

> I have a couple of questions regarding the new Python garbage collector:
> 
>   (1) Why does it use the rather unusual algorithm it does, rather
>       than a more typical mark and sweep?  The per-object storage cost for
>       the extra reference count is surely greater than the bit or two
>       required for a typical mark and sweep.

I'm not positive, but I think it's for simplicity.

Frankly, I'm a bit confused as to why everybody and
their brother seems to want to implement reference
count based garbage collectors when better has been
available through languages like LISP for years.  I
do know for a fact though that reference counting is
 a lot easier than other forms of GC.  It does tend
to get tricked by circular references.  I'm not sure
if this is an issue in python, but I believe it still
is in perl.  In perl you can have two variables which
merely refer to each other that will never get GC'd
because their reference count will always be > 0.

I plead ignorance on most GC issues - I'm hoping somebody
will jump in and let us know The Official Reason(TM).
That, and why software today isn't using years of 
research on GC techniques to its advantage.

I'd crosspost this to comp.lang.lisp if I didn't know
it would generate flamage.

-- 
David Allen
http://opop.nols.com/
----------------------------------------
Great minds run in great circles.



More information about the Python-list mailing list