|
Boost : |
From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-11-15 23:36:51
Larry Evans wrote:
[...]
> I've gotta amend that. It'll work as long as the weights in the
> smart pointers don't drop to 1. If this happens, then the weight
> associated with the pointee needs to be augmented to maintain
> the invariant:
>
> RC(N) = sum(N) weight<X,N>
>
> (see section 2 of the previously cited reference). where:
>
> RC(N) = the reference count for pointee N.
> sum weight<X,N> = sum of weights of all smart pointers, X with
> pointee, N.
>
> When a smart pointer is removed or changes it's pointee, the smart
> pointer's weight is decremented from the pointee's RC.
"on-the-fly" reference counting seems to be the ideal candidate for Java's
mark-and-sweep garbage collector:
http://www.cs.technion.ac.il/~erez/Papers/refcount.ps
What do you think...?
Philippe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk