Performance Optimization
Ruby 2.7: Understand and debug problems with heap compaction

Ruby 2.7: Understand and debug problems with heap compaction

4/28/2021 · Matthias Käppler

What this post added

This post details the investigation and resolution of a production incident caused by Ruby 2.7's heap compaction feature when used with Puma's 'nakayoshi_fork'. It explains the concepts of tenuring objects and heap compaction, the challenges encountered with C-extensions like Hamlit due to improper object marking, and the specific fix implemented in Hamlit to resolve segfaults by statically resolving constants and using `rb_gc_register_mark_object`. It also highlights the need for more reliable detection of compaction-related issues in CI.

Read the original post ↗