Project

General

Profile

Bug #17985 ยป bug17882-gcmod.rb

Repro: a mod of `bootstraptest/test_ractor.rb:224` - xtkoba (Tee KOBAYASHI), 06/14/2021 06:08 PM

 

def test n
rs = (1..n).map do |i|
Ractor.new(i) do |i|
"r#{i}"
end
end
as = []
all_rs = rs.dup

n.times{
r, obj = Ractor.select(*rs)
as << [r, obj]
rs.delete(r)
}

if as.map{|r, o| r.object_id}.sort == all_rs.map{|r| r.object_id}.sort &&
as.map{|r, o| o}.sort == (1..n).map{|i| "r#{i}"}.sort
'ok'
else
'ng'
end
end

GC.disable

p 30.times.map{|i|
test i
}

GC.start
    (1-1/1)