3 ms·
I'm a bit surprised to find no discussion of reference counting versus tracing GC, only a couple of passing mentions. On the one hand, I suppose this has alread
by mwcampbell 7y ago
I'm a bit surprised to find no discussion of reference counting versus tracing GC, only a couple of passing mentions. On the one hand, I suppose this has already been discussed to death. And if the author felt it would be more fun to write and read about actually implementing mark-and-sweep GC, fair enough. On the other hand, reference counting definitely has its place, and I'd be curious to know more about the author's opinion on it, given his background in game scripting languages. Some scripting languages that have been put to good use in games, such as AngelScript [1] and Squirrel [2], use reference counting.
Edit: My mistake; he discussed it back in chapter 3.
[1]: https://www.angelcode.com/angelscript/ https://www.angelcode.com/angelscript/
[2]:: http://squirrel-lang.org/ http://squirrel-lang.org/
- carapace 7y agoFWIW, in re: reference counting vs. tracing GC "A Unified Theory of Garbage Collection" https://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon04Unified.pdf https://researcher.watson.ibm.com/researcher/files/us-bacon/... > Tracing and reference counting are uniformly viewed as being fundamentally different approaches to garbage collection that possess very distinct performance properties. We have implemented high-performance collectors of both types, and in the process observed that the more we optimized them, the more similarly they behaved— that they seem to share some deep structure. > We present a formulation of the two algorithms that shows that they are in fact duals of each other. Intuitively, the difference is that tracing operates on live objects, or “matter”, while reference counting operates on dead objects, or “anti-matter”. For every operation performed by the tracing collector, there is a precisely corresponding anti-operation performed by the reference counting collector. > Using this framework, we show that all high-performance collectors (for example, deferred reference counting and generational collection) are in fact hybrids of tracing and reference counting. We develop a uniform cost-model for the collectors to quantify the trade-offs that result from choosing different hybridizations of tracing and reference counting. This allows the correct scheme to be selected based on system performance requirements and the expected properties of the target application.
- pcwalton 7y agoThis is one of my favorite papers. It's a very accessible article that dispels the myth that reference counting is somehow not a form of garbage collection.
- munificent 7y ago> This is one of my favorite papers. Mine too. It's a gem.