Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Understanding the Ruby Garbage Collector (omniref.com)
54 points by montanalow on Oct 31, 2014 | hide | past | favorite | 8 comments


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


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


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.


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.


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).


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?


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.


Sorry, my mistake -- the code changed slightly from 2.1.2 to 2.1.3, and the annotation didn't get cross-posted. I've updated it!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: