File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2417,13 +2417,24 @@ def call_test(obj)
24172417# When creating bmethods in Ractors, they should only be usable from their
24182418# defining ractor, even if it is GC'd
24192419assert_equal 'ok' , <<~'RUBY'
2420- CLASSES = 1000.times.map do
2421- Ractor.new do
2422- Class.new do
2423- define_method(:foo) {}
2424- end
2420+ CLASSES = 1000.times.map { Class.new }.freeze
2421+
2422+ # This would be better to run in parallel, but there's a bug with lambda
2423+ # creation and YJIT causing crashes in dev mode
2424+ ractors = CLASSES.map do |klass|
2425+ Ractor.new(klass) do |klass|
2426+ Ractor.receive
2427+ klass.define_method(:foo) {}
24252428 end
2426- end.map(&:value).freeze
2429+ end
2430+
2431+ ractors.each do |ractor|
2432+ ractor << nil
2433+ ractor.join
2434+ end
2435+
2436+ ractors.clear
2437+ GC.start
24272438
24282439any = 1000.times.map do
24292440 Ractor.new do
You can’t perform that action at this time.
0 commit comments