
Issue #19584 has been updated by peterzhu2118 (Peter Zhu).
This requirement seems documented but one need to read it very carefully to notice it
The documentation was changed a few days ago in [4adcfc8cd7a17593a6590025da2b03eebf4fd63c](https://github.com/ruby/ruby/commit/4adcfc8cd7a17593a6590025da2b03eebf4fd63c). The old documentation did not mention this requirement at all.
Inform the garbage collector that `valptr` points to a live Ruby object that should not be moved. Note that extensions should use this API on global constants instead of assuming constants defined in Ruby are always alive. Ruby code can remove global constants.
---------------------------------------- Bug #19584: Crash in rb_gc_register_address https://bugs.ruby-lang.org/issues/19584#change-102705 * Author: peterzhu2118 (Peter Zhu) * Status: Closed * Priority: Normal * Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- GitHub PR: https://github.com/ruby/ruby/pull/7670 Some C extensions pass a pointer to a global variable to rb_gc_register_address. However, if a GC is triggered inside of rb_gc_register_address, then the object could get swept since it does not exist on the stack. -- https://bugs.ruby-lang.org/