Project

General

Profile

Actions

Bug #17360

closed

Objects disappear from ObjectSpace after using Ractor

Added by Dan0042 (Daniel DeLorme) about 4 years ago. Updated about 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:101204]

Description

Test:

GC.disable
STR = -"testing 123"
x = STR.dup
puts "before:"
ObjectSpace.each_object(String){ |s| puts s.object_id if s == STR }
Ractor.new{ }.take
puts "after:"
ObjectSpace.each_object(String){ |s| puts s.object_id if s == STR }

Result:

before:
60
80
100
<internal:ractor>:38: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
after:
80

Expected result:
Same object ids should be printed before and after

(BTW why 3 strings with the same value? shouldn't it be 2?)


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #21149: Strange behavior of ObjectSpace.each_object after Ractor.newRejectedActions

Updated by shyouhei (Shyouhei Urabe) about 4 years ago

  • Status changed from Open to Rejected

Yes this is an intentional behaviour as of 3.0. Currently Ractor and ObjectSpace do not interface well. You cannot mix them now.

Actions #2

Updated by wanabe (_ wanabe) 3 days ago

  • Has duplicate Bug #21149: Strange behavior of ObjectSpace.each_object after Ractor.new added
Actions

Also available in: Atom PDF

Like0
Like0Like0