4 ms·
It's interesting to compare this to how python does it (reference counting with generations): http://patshaughnessy.net/2013/10/30/generational-gc-in-python-and
by AlexanderDhoore 13y ago
It's interesting to compare this to how python does it (reference counting with generations): http://patshaughnessy.net/2013/10/30/generational-gc-in-python-and-ruby http://patshaughnessy.net/2013/10/30/generational-gc-in-pyth...
"At first glance, Ruby and Python seem to implement garbage collection very differently. Ruby uses John McCarthy’s original mark and sweep algorithm, while Python uses reference counting. But when we look more closely, we see that Python uses bits of the mark and sweep idea to handle cyclic references, and that both Ruby and Python use generational garbage collection in similar ways. Python uses three separate generations, while Ruby 2.1 uses two.
This similarity should not be a surprise. Both languages are using computer science research that was done decades ago – before either Ruby or Python were even invented. I find it fascinating that when you look “under the hood” at different programming languages, you often find the same fundamental ideas and algorithms are used by all of them. Modern programming languages owe a great deal to the ground breaking computer science research that John McCarthy and his contemporaries did back in the 1960s and 1970s."
- oleganza 13y agoI think Henry Baker had a paper on why generational and refcounting GCs are ultimately equivalent. Couldn't find it quickly, though, to give you a link.
- hencq 13y agoI think you might be thinking of this paper: A unified theory of garbage collection [1], which shows how most modern collectors are hybrids of GC and ref counting. [1] http://atlas.cs.virginia.edu/~weimer/2008-415/reading/bacon-garbage.pdf http://atlas.cs.virginia.edu/~weimer/2008-415/reading/bacon-...
- oleganza 13y agoOh, it was David Bacon. Thanks for finding this link.
- brandonbloom 13y agoFor the record: This is a very good paper. It's extremely easy to read, even for somebody who knows nothing about the background, and the scientific result is absolutely beautiful!
- kirubakaran 13y agoI just wanted to say thank you for this comment. I'm reading the paper because of it. Can you please point me to your other favorites that are good + accessible?
- brandonbloom 13y agoI wouldn't even know where to start :-)
- kirubakaran 13y agoHaha you aren't getting off that easy. Could you please tell me, say, 3 that come to your mind?
- iagooar 13y agoIsn't it actually kind of sad, that such important researches don't get considered until 40 or 50 years later?
- riffraff 13y agoI don't think such research wasn't considered, it's been used constantly in many projects since. The reason why some platforms have "silly" choices like stop the world M&S GC, or interpreters with AST walking is, likely, that optimization wasn't a goal in the original implementation and it's hard to retrofit it while keeping compatibility.