This is actually very standard stuff, and there are many other
things to look at if you find it interesting.
Here's a few GC's I know: The JFM does copying GC which is similar
in principal: it copies the data structures recursively from the
roots to another memory region, and then zaps all the original
memory in one go. The Objective-Caml GC is very interesting, it has
a mark and sweet one with interesting behavior for objects that only
live on the dynamic stack, etc. Haskell's GC is even stranger
because of its graph reduction based evaluation,
I would like to see a selective GC though, one where certain objects
are marked for immediate finalization but others can be dealt with
in sweeps, so you have the best of both worlds (the immediacy of
reference counting with the performance and robustness of a full
sweep).
For what it's worth, Perl 5 has a mark & sweep pass too, at global
destruction (which causes some strange things if you rely on child
data structures in DESTROY).
Cheers,
--
Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org 0xEBD27418