[Python-3000] Delayed reference counting idea

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 19 06:52:22 CEST 2006


Adam Olsen wrote:
> Reference counting turns all references into
> modifications.
> 
> There's a few ways to approach this:

I've just thought of another one: Instead of a single
refcount per object, each thread has its own set of
refcounts. Then the object has a count of the number
of threads that currently have nonzero refcounts for
it.

Most refcount operations would only affect the
thread's local refcount for the object. Only when that
reached zero would you need to lock the object and
update the global refcount.

Not sure what kind of data structure you'd use for
this, though...

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-3000 mailing list