From 59fb5d4fa3e21dd00f8f45999bb7b4be9418429c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 23 Feb 2021 16:36:04 -0500 Subject: [PATCH] Add tests for bug 17652 --- test/ruby/test_gc_compact.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index 4a8cff33f4..c4277d1ffe 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -60,6 +60,22 @@ class TestGCCompact < Test::Unit::TestCase GC.auto_compact = before end + def test_bug_17652 + assert_in_out_err([], "#{<<~"{#"}#{<<~'};'}", timeout: 60) + {# + GC.auto_compact = true + + times = 20_000_000 + arr = Array.new(times) + times.times do |i| + arr[i] = "#{i}" + end + + arr = Array.new(1_000_000, 42) + GC.start + }; + end + private def supports_auto_compact?