[Gc] Re: GC needs to be invoked manually

Larry Evans cppljevans at cox-internet.com
Sun Aug 28 13:04:43 PDT 2005


On 08/26/2005 03:56 PM, Martin Wartens wrote:
> Meanwhile I discovered that I have to replace "traceable_allocator" 
> with "gc_allocator" to make the sample program work. traceable_allocator uses 
[snip]
>> ever collected. This behavior also depends on the size of the array. Collection 
> fails if the array has more than 26 entries (=104 bytes).

The code at:

http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/libs/policy_ptr/test/wartens_sparse_matrix_test.cpp?rev=1.1&view=auto

uses reference counting, but that's just one gc policy.  It's fairly
easy to convert to just use a single boolean mark or bit instead of
a reference count to save memory and time to do the refcount updates.

The code also demonstrates that cycles are no problem with refcounting
if it's combined with the backup marksweep of [chri84] cited here:

   http://www.cs.kent.ac.uk/people/staff/rej/gcbib/gcbibC.html

I'd be happy to add this extra gc policy if you're interested.

HTH.

-regards,
Larry



More information about the Gc mailing list