garbage collection / reference cycles (cont.)

Aaron Brady castironpi at gmail.com
Sun Mar 29 09:06:53 CEST 2009


On Mar 25, 12:11 am, Aaron Brady <castiro... at gmail.com> wrote:
> Hello,
>
> I am posting the code I mentioned on Saturday that collects garbage
> and cyclic garbage in a flattened two-step process.  The code takes
> 122 lines incl. comments, with 100 in tests.  It should be in a reply
> to this.
>
> My aim is a buffer-like object which can contain reference-counted
> objects.  This is a preliminary Python version of the cycle detector.

snip formality

Someone suggested that it wasn't clear to them what my goal was in
this post.  I created a garbage collector that has an extra method
that user-defined objects don't have in Python's.  It is 'final_attr',
which requests the objects to drop their reference to the specified
attr.  After it returns, the object is moved to the back of the
collection queue.  This means that it knows what references of its own
it is losing; they are still valid at the time 'final_attr' is called;
and other objects' references to /it/ are still valid too.

I want a technical discussion of its strengths and weaknesses.

Aahz suggested to try python-ideas:
http://mail.python.org/pipermail/python-ideas/2009-March/003774.html



More information about the Python-list mailing list