garbage collection / reference cycles (cont.)

A

Aaron Brady

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.
I expect to port it to C++, but the buffer object as well as object
proxies are Python objects. The memory management strategy,
synchronization, etc., are other modules. It is similar in principle
to Python's own 'gc'. If it's sound, it may have some educational and
explanatory value also.

Anyway, since I received a little interest in it, I wanted to follow
up. It is free to play with. If there's a better group to ask about
this, or there are more scholarly, widely-used, or thorough treatments
or implementations, I'm interested.
 
A

Aaron Brady

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top