While playing with the GC in different ruby implementations i’ve got a
pretty odd situation with MRI GC.
here is the code i’ve used with the results -
If i understand correctly the both implementations(MRI and REE) uses the
same GC strategy - mark and sweep.
The problem is that the MRI is not deallocating objects after the
reference is removed.
I’m not certain is it a bug or I misunderstood some GC concepts.
PS: The allocations are confirmed with vmmap tool so it’s not an live
objects calculation problem.
The problem is that the MRI is not deallocating objects after the
reference is removed.
I’m not certain is it a bug or I misunderstood some GC concepts.
I think it’s in your understanding. Same strategy does not imply
identical algorithm. Even if both implementation use M&S they still
might have different algorithms to detect liveness of objects. It may
actually make sense to be more conservative about liveness if the
check is faster then. That would result in less objects being
collected.
Bottom line is there are no guarantees as to when an object is
collected. It can long be unreachable before it is actually
collected.
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.