14. RGenGC: Restricted Generational
Garbage Collection
New generational GC algorithm permits
Write-barrier (WB) protected objects AND
WB un-protected object in the same heap
15.
16. RGenGC - Key Idea
•
Separate Objects
!
!
•
Shady Object points to new Object?
We don’t know!
•
Decide at Creation
Class cares about WB and don’t cares about non-WB
•
Normal objects can be changed to Shady objects
17. OLDGEN AND MINOR MARKING
!
!
•
Only protected objects can be promoted to oldgen
•
Unprotected objects cannot be promoted, but if referenced from oldgen
they are added to a remembered set.
•
Minor marks are much faster because they only have to traverse references
from the remembered set
18. TUNING THE GC IN RUBY 2.1
Memory allocation → GC
•
Every time allocate n size memory (call malloc(n))
increase malloc_increase with n
•
If malloc_increase > malloc_limit, then cause GC
!
Adaptive tuning
•
If malloc_increase exceeds malloc_limit, then increase malloc_limit
(by a factor of GC_MALLOC_LIMIT_GROWTH_FACTOR) up to
GC_MALLOC_LIMIT_MAX
23. METHODS CACHE
Ruby 2.1 introduces a hierarchical class cache similar
to the what Rubinius and JRuby use
Aman Gupta:
“Early numbers show up to 5-10% improvements”
!
More improvements in Ruby 2.2
24. PRODUCTION READY?
•
breaks the faraday gem
•
affects the sass gem
•
segv inside active_support_4 and other gems
•
Performance Patches by funny-falcon