[Python-Dev] Linus on garbage collection

Mark Shannon marks at dcs.gla.ac.uk
Fri May 6 18:33:03 CEST 2011

skip at pobox.com wrote:
>     Antoine> Since we're sharing links, here's Matt Mackall's take:
>     Antoine> http://www.selenic.com/pipermail/mercurial-devel/2011-May/031055.html
>>From that note:
>     1: You can't have meaningful destructors, because when destruction
>     happens is undefined. And going-out-of-scope destructors are extremely
>     useful. Python is already a rather broken in this regard, so feel free
>     to ignore this point.
> Given the presence of cyclic data I don't see how reference counting or
> garbage collection win.  Ignoring the fact that in a pure reference counted
> system you won't even consider cycles for reclmation, would both RC and GC
> have to punt because they can't tell which object's destructor to call
> first?

It doesn't matter which is called first.
In fact, the VM could call all the destructors at the same time if the 
machine has enough cores and there's no GIL.

All objects are kept alive by the GC until after the destructors are 
called. Those that are still dead will have their memory reclaimed.

> Skip
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/marks%40dcs.gla.ac.uk

More information about the Python-Dev mailing list