I will talk about some improvements of GC in Ruby 2.0.0. For instance, I will introduce about implementations of Bitmap Marking GC and so on, and show results of benchmarks after these are implemented.
Animation version is here: https://gumroad.com/l/xWCR (premium version)
1. fail-safe system is slow➔Rescanning is so slow.– If you have some deep object graphs,GC may be always slow withrescanning.
2. We cant precisely checkstack overflow➔There is a trade-off between speedand precision.– Marking will be slow if we check stackoverflow in each gc_mark().– So we checked it at the appropriatetime.– But, its not precise.
2. We cant precisely checkstack overflow➔This causes SEGV in the worst casescenario– For instance, Fiber sometimes failsunexpectedly.– Fiber uses small machine stack(128 KB)– At times, checking for stack overflowsdoesnt work well with Fiber.
Allocating aligned memory➔Using posix_memalign()– For Unix-like OS➔Using _aligned_malloc()– For Windows OS– mingw: __mingw_aligned_malloc()
Allocating aligned memory➔Using malloc()● Thanks to yugui-sans help!– For other environments– For instance, Max OS X Lion and so on– It allocates 32KB and returns an addresswhich is a multiple of 16KB● 16KB memory space is wasted● We should use mmap(), but ....