Repository navigation
Add a benchmark for conservative stack scanning in Ractors - #559
Open
eightbitraptor wants to merge 1 commit into
Open
eightbitraptor wants to merge 1 commit into
eightbitraptor wants to merge 1 commit into
Conversation
The Ractor benchmarks keep their live objects in Ruby frames, so none of them makes a worker Ractor's GC scan a deep machine stack where some objects are referenced only from C stack slots. This commit adds ractor-conservative-stack. Each worker bounces Ruby -> C -> Ruby through a small C extension whose frames hold live VALUEs, interior pointers, C pointers and scalars. At the bottom of the stack it allocates garbage and runs a minor GC. Each frame checks the objects that only its C stack slots reference as it returns, so a missed conservative root raises RactorStackScan::CorruptionError. The benchmark builds its extension with extconf.rb and make into build/<key>, where the key covers the sources and the Ruby build, and we ignore that directory.
eightbitraptor
force-pushed
the
mvh-ractor-conservative-stack
branch
from
October 19, 2026 16:06
fdae401 to
516c291
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Ractor benchmarks keep their live objects in Ruby frames, so none of them makes a worker Ractor's GC scan a deep machine stack where some objects are referenced only from C stack slots.
This commit adds ractor-conservative-stack. Each worker bounces Ruby -> C -> Ruby through a small C extension whose frames hold live VALUEs, interior pointers, C pointers and scalars. At the bottom of the stack it allocates garbage and runs a minor GC. Each frame checks the objects that only its C stack slots reference as it returns, so a missed conservative root raises RactorStackScan::CorruptionError.
The benchmark builds its extension with extconf.rb and make into build/, where the key covers the sources and the Ruby build, and we ignore that directory.