A couple garbage collector questions

Ken Seehof kens at sightreader.com
Mon Apr 2 21:24:01 EDT 2001


Python 2.0 has a smarter garbage collector.  It's still reference-counting,
but it cleans up circular references.

----- Original Message -----
From: "David Allen" <mda at idatar.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, April 02, 2001 4:51 PM
Subject: Re: A couple garbage collector questions


> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
>





More information about the Python-list mailing list