[Gc] libgc not collecting objects with cyclic references ?

Christophe Meessen meessen at cppm.in2p3.fr
Mon Mar 19 01:12:53 PST 2007


Hello,

I am a bit confused by the following comment in gc_cpp.h

"Thus, if objects A and B both have clean-up functions, and A points at
B, B is considered accessible.  After A's clean-up is invoked and its
storage released, B will then become inaccessible and will have its
clean-up invoked.  If A points at B and B points to A, forming a
cycle, then that's considered a storage leak, and neither will be
collectable.  See the interface gc.h for low-level facilities for
handling such cycles of objects with clean-up."

I am a bit surprized about the statement that cycle references are not
resolved by the gc. Does this apply only to blocks with clean-up
functions ? Is the destructor of a C++ function a clean-up function ?




More information about the Gc mailing list