[Python-3000] Delayed reference counting idea

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 20 02:22:47 CEST 2006


Marcin 'Qrczak' Kowalczyk wrote:

> Objects which should be closed deterministically have the closing
> action decoupled from the lifetime of the object.

That doesn't cover the case where the "closing" action
you want includes freeing the memory occupied by the
object. The game I mentioned earlier is one of those --
I don't need anything "closed", I just want the memory


  They are closed
> explicitly; the object in a "closed" state doesn't take up any
> sensitive resources.
> 
> 
>>I just think that it's important to remember that there are use
>>cases that reference counting solves. GC and refcounting both have
>>their pros and cons.
> 
> 
> Unfortunately it's hard to mix the two styles. Counting all reference
> operations in the presence of a real GC would imply paying the costs
> of both schemes together.
> 
> 
>>I tend to think that Python's current refcounting + cyclic gc is the
>>devil we know, so unless there is a clear, proven better way I'm not
>>eager to change it.
> 
> 
> They are different sets of tradeoffs; neither is universally better.
> I claim that a tracing GC is usually better, or better in overall,
> but it can't be proven to be better in all respects.
> 
> Changing an existing system creates more compatibility obstacles than
> designing a system from scratch. I'm not convinced that it's practical
> to change the Python GC now. I only wish it had a tracing GC instead.
> 



More information about the Python-3000 mailing list