summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-08-02 08:38:30 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-08-02 10:18:22 +0900
commit4453280bb4aee7975d8e93e3d6bc8bfe8d75775f (patch)
treeecb7274376f016531c33665fd4898f7396ce1c6b /test
parent605421f4ebe37699e63eb5551c3dbc7887093e4f (diff)
Stop infinite object allocation to get rid of OOM killer
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4697
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc_compact.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb
index 7d8bde04f8..46683d0ed5 100644
--- a/test/ruby/test_gc_compact.rb
+++ b/test/ruby/test_gc_compact.rb
@@ -69,10 +69,11 @@ class TestGCCompact < Test::Unit::TestCase
}
count = GC.stat :compact_count
GC.auto_compact = true
- loop do
+ n = 1_000_000
+ n.times do
break if count < GC.stat(:compact_count)
list2 << Object.new
- end
+ end and skip "implicit compaction didn't happen within #{n} objects"
compact_stats = GC.latest_compact_info
refute_predicate compact_stats[:considered], :empty?
refute_predicate compact_stats[:moved], :empty?