

Understanding the Ruby Garbage Collector - montanalow
https://www.omniref.com/ruby/2.1.3/symbols/GC#annotation=4035152&line=1

======
grandalf
Omniref is cool, but why can't this level of explanation live in source code
comments so we can simply generate it with docco?

~~~
montanalow
Technical writing and programming aren't necessarily the same skill set.

------
amelius
This is nice. But I'm wondering, why do garbage collectors always have to be
written from scratch for each project? Why can't we just have a library that
does garbage collection, and does it well?

Of course, the library should take a couple of parameters (such as the
primitives to use for memory barriers, multithreading parameters etc.) I know
of the Boehm collector, but it is conservative, so not appropriate for many
projects.

Also, I'd expect to find garbage collection (or supporting constructs) in the
C++ standard by now, actually.

~~~
chrisseaton
You say the library should take a couple parameters, such as the primitive to
use for memory barriers - but the memory barriers are something the GC would
need to tell the compiler about, not the other way around. So your library
needs to know about how your compiler works, and it's no longer really a
library, it's now a language feature that needs to tie into the most intimate
parts of your compiler's intermediate representation. That's why you don't get
libprecisegc.o.

~~~
amelius
Yes, I agree that there should be cooperation between the library and the
compiler. But that is also the case for RAII, for example, where the compiler
provides the primitives (through language design, e.g., constructors,
destructors, copy constructors, etc.) which allow it to work. I'm just
wondering why no such thing exists for garbage collection (yes, I'm aware that
the interface would be much more complicated).

------
ufmace
I can't find the second page of the comment/article/whatever, on the
ObjectSpace. The link from the first page goes kinda to the third, and the
link from the third back to ObjectSpace goes to the same place. Maybe this
ought to be a blog post?

~~~
mordocai
If you click the speech bubble next to the lines of code that the ObjectSpace
link goes to it opens another annotation causing the next part of the
explanation to pop up.

