18 Mar '13, 5am
“Rubyist Magazine - Ruby 2.0.0: GC improvements”
In previous versions of Ruby, the object graph is traversed and marked by using a recursive function call on the machine stack. This may lead to stack overflow when a very deep object graph is traversed. To avoid this, previous versions of Ruby GC stop using the machine stack when a stack overflow is about to happen. However, this leads to two additional problems: Marking becomes extremely slow when there are deeply referenced objects. The quality of detecting a stack overflow is not accurate. For the former case, the worst case scenario is very slow because not using the machine stack means you need to search for everything in the heap. In addition, GC will be slow as long as these deeply referenced objects exist. For the latter, it is very difficult to accurately check stack overflow in time, and sometimes this causes SEGV. In the worst case scenario, Fiber fails in the ...