Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-09-03 10:20:28

Philippe A. Bouchard wrote:

>Larry Evans wrote:

>This could be an option defined by a global variable or flag, because I
>guess the cyclic_ptr algorithm will have to be called for each pointer
>construction (or destruction) on the heap (too bad there is no portable way
>to detect the memory segment on which construction is made).
The Greg's cyclic_ptr algorithm is only called when the user decides to
garbage collect.
I was thinking this would be changed to ONLY be called with the "certain
I mentioned in another post was met. This criteria is like your
`g.size()==100` in
your earlier post. Other criteria might be a certain % of memory in
heap or swap space
used. I think Boehm has some such criteria. When this happens, then,
to Greg's algorithm (actually it's T.W.Christopher's _Soft. Prac.&Expr._
the set of rc pointers decrements each rc pointer of which it's the
parent. This leaves
the non-zero rc pointers only on stack. These are then traced to find
the live rc pointers.
The rest are collected. Hence, the time taken would be comparable to
that taken by
a regular conservative GC. The only difference it the method to
enumerate the rc pointers
on the stack.

There is an alternate method, the "eager local mark-scan" method, which
does run each
time a decrement is made. This found in "Cyclic reference counting with
local mark-scan"
in _Information Processing Letters_, 34:1990. A compromise between
these is the
"lazy local mark-scan". All these are described in the book described

Boost list run by bdawes at, gregod at, cpdaniel at, john at