Boost logo

Boost :

From: Achilleas Margaritis (axilmar_at_[hidden])
Date: 2007-09-23 18:56:03


O/H Seweryn Habdank-Wojewódzki έγραψε:
> Hi
>
> There are some GC for C++.
>
> http://sourceforge.net/projects/sgcl/
> http://smieciuch.sourceforge.net/
> http://www.morefor.org/documentation/gc.html
> http://sourceforge.net/projects/librtgc/
>
> Regards.
>

Thanks. I took a little time to study them. The following text contains
a short review for each one.

1) http://sourceforge.net/projects/sgcl/ :

I don't understand anything, the documentation is in the author's native
language, which is not English. It is supposed to be a concurrent
parallel-marking conservative collector.

 From looking at the sources, I saw references to VirtualQuery and other
Win32 functions, so I presume it is a Windows-only collector.

It does not have any special ptr class, because it checks all stack
areas and globals. It's 2500 lines of code.

The collector reads the data and copies them to another area in order to
examine them. I think all parallel collectors work like that.

2) http://smieciuch.sourceforge.net/ :

It's a C++ only collector (did not see any O/S specific code). The
basics are the same as in my collector: special smart ptr classes are
registered with the collector.

The pointer registration routine searches the available objects to
determine if a pointer is on the heap or is a root pointer. From what I
can understand, the author has done some nice tricks with vectors and
sorting to quickly locate the block a pointer belongs to. The code is a
little on the difficult-to-read side.

3) http://www.morefor.org/documentation/gc.html:

Practically the same as above, but a little more naive: the search for
the block that a pointer falls into is sequential. Must be really slow
for large data sets. The code is a little bit on the ugly side.

4) http://sourceforge.net/projects/librtgc/:

C++ only collector. It uses reference counting, but it separates stack
ref counting from heap ref counting. Basically, it works like this:

1) a DRef (direct reference) is a reference from the stack or global data.

2) a IRef (indirect reference) is a reference from other heap objects.

If the direct reference count drops to 0, then the object is examined if
it should be collected. An object is collectable if all the references
it has is IRefs.

In order for this to be achieved, special coding is required so as that
member pointers are linked with owner objects.

Overall, #1 seems to be good work but it is Windows-only, #2 and #3 are
based on the same principle as mine (a pointer not on the heap is a
root), and #4 is based on reference counting.

I really doubt any of the above, except #1, could be used for serious
work. #2 and #3 seem very slow, and #4 is difficult to program for.

I think that the solution with bit-maps is the fastest possible for
precise collection.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk