Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Ruby GC safety #131

Open
uvlad7 opened this issue Jan 10, 2025 · 0 comments
Open

Question about Ruby GC safety #131

uvlad7 opened this issue Jan 10, 2025 · 0 comments

Comments

@uvlad7
Copy link

uvlad7 commented Jan 10, 2025

You mention in the README that "Ruby objects must be kept on the stack". This, in fact, is only required if your code might trigger GC. But I'm actually asking about how to ensure that this VALUE isn't optimized away by the compiler or stored in a register? AFAIK, in Ruby C API, volatile is used, but it's main purpose is a bit different and Rust's {read,write}_volatile covers it, but not Ruby's keep it on the stack need. But I'm not really sure about this as Ruby's docs - at least what I've found - don't cover this and I'm experienced in C. Can you please clarify the Rust part?

UPD: Found info about RB_GC_GUARD, maybe it's worth mentioning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant