[DOC] ObjectSpace#each_object behavior in multi-Ractor mode
This behavior of ObjectSpace#each_object has been around since Ruby 3.0 when Ractors were first introduced, but was never documented and has caused some amount of confusion: https://bugs.ruby-lang.org/issues/17360 https://bugs.ruby-lang.org/issues/19387 https://bugs.ruby-lang.org/issues/21149
This commit is contained in:
parent
6dd7a7bb41
commit
a51b4a86fc
Notes:
git
2025-05-10 17:32:34 +00:00
11
gc.c
11
gc.c
@ -1545,6 +1545,17 @@ os_obj_of(VALUE of)
|
||||
* 2.2250738585072e-308
|
||||
* Total count: 7
|
||||
*
|
||||
* When the process is in multi-Ractor mode (when <code>Ractor.new</code>
|
||||
* has been called within the process at least once), this method yields
|
||||
* Ractor-shareable objects only.
|
||||
*
|
||||
* a = 12345678987654321 # shareable
|
||||
* b = [].freeze # shareable
|
||||
* c = {} # not shareable
|
||||
* ObjectSpace.each_object {|x| x } # yields a, b, and c
|
||||
* Ractor.new {} # enter multi-Ractor mode
|
||||
* ObjectSpace.each_object {|x| x } # does not yield c
|
||||
*
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
Loading…
x
Reference in New Issue
Block a user