
On 2018-07-19 11:53, Jonathan Fine wrote:
Hi Stephan
Thank you for the extract from the GC Handbook, which I think I may have seen before. Yes, it is GOOD that it's an already known idea.
Searching for "buffered reference counting" I found https://mail.python.org/pipermail/python-dev/2016-October/146696.html in which Larry Hastings says that C-python "plays games with reference counts" which makes implementing "buffered reference counting" harder. And he gives examples.
Larry also writes [loc cit] about resurrecting objects. I don't know what he means by this. It may be something to do with weak references. Larry's post gives some details, in which difficulties may lie. In particular, he writes === https://mail.python.org/pipermail/python-dev/2016-October/146604.html It's my contention that this API [for weak references] is simply untenable under the Gilectomy, and that it needs to change to returning a new (strong) reference.
[snip] When an object's refcount drops to 0, the object's __del__ method (if defined) is called, and then the object's memory can be reclaimed. But what if the __del__ method creates a new reference to the object? The object's refcount is no longer 0, so the object is no longer garbage. That's called "resurrecting an object".