lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> Other downsides to GC: you have to maintain a list of root objects
> and make sure that all roots are discoverable when the GC runs,
> most GC algorithms stop all threads and have practically unbounded
> latency for a full collection, GC can often require tuning for demanding
> work-loads.
> IMO the worst drawback of refcounting by far is that by itself it
> cannot collect cyclic references.

Reference counting can count cycles, too.  For instance, I'm using the algorithm in

[1] Bacon, DF and Rajan VT.  “Concurrent cycle collection in reference counted systems”.  Proc. ECOOP 2001.  LNCS 2072.

The garbage collection I'm working with doesn't need to be thread-safe, so I can use the simpler algorithm from §3 of that paper.  It has to maintain roots, but only the roots of possible cycles when an object is decref-ed.

Then again, maybe there are enough additional functions in that algorithm that you've just bolted a tracing collector on to the reference counting collector...