graham at sloth.math.uga.edu
Thu Jun 3 21:06:29 CEST 1999
Graham Matthews wrote:
> You don't need a new method call -- all you need is a mark and sweep
> collector with refcounts. I really am amazed that this has generated so
> much traffic. It's very simple. You have ref counts just like you do
> now in Python. When an objects refcount goes to 0 its __del__ method
> is called. On top of this you add a mark and sweep collector to handle
> circular references. During a sweep if it finds dead objects it calls
> the __del__ method for that object.
Salvador =?iso-8859-1?Q?Fandi=F1o?= (fandino at usa.net) wrote:
: GC usually deletes objects in random order which is not a very good
I am sorry but this comment is all myth. Think about what I wrote
above. Imagine Joe average Python program P. If P contains no
circular references then *under the scheme I propose above*
P's behaviour will be EXACTLY the same as it is in current Python
(no circular refs means the mark sweep collector will never find
any dead wood and hence never need to call any __del__ methods -- all
the __del__ calls will be via the ref count mechanism as it is now!).
The calls to the __del__ methods will happen EXACTLY as they do now. If
P contains circular refs then current python will never reclaim the
resources associated with these refs. *Under the scheme I propose above*
these resources will be reclaimed, *when* the mark sweep collector runs.
Certainly one has no control over when exactly that will be, but at least
the resources will be reclaimed, unlike under the current Python where
they will never be reclaimed.
Why is it so hard for people to see that adding a mark sweep collector
*ON TOP OF* the existing ref count scheme essentially changes nothing.
All the current ref count behaviour that people love will stay. The
only additional behaviour will be that circular refs are mopped up
The fool escaped from paradise
will look over his shoulder and cry
Sit and chew on daffodils and
struggle to answer why?
More information about the Python-list