summaryrefslogtreecommitdiff
path: root/test/ruby/test_gc_compact.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2019-05-09 13:13:56 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2019-05-14 20:21:03 -0700
commitc70ceb59928aa2c37befd6b03d73657ba5ece61c (patch)
tree6f2ee7481ca47480f93a79256e64b173090a31bd /test/ruby/test_gc_compact.rb
parent46a479889cb5be2a7a24d6adbe54e822899d96cc (diff)
Add object packing strategies for compaction
This commit adds an alternative packing strategy for compaction. Instead of packing towards "most pinned" pages, we can pack towards "most empty" pages. The idea is that we can double the heap size, then pack all objects towards the empty side of the heap. This will ensure maximum chaos for testing / verification.
Diffstat (limited to 'test/ruby/test_gc_compact.rb')
-rw-r--r--test/ruby/test_gc_compact.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb
index b705f601da..5669fd3d6a 100644
--- a/test/ruby/test_gc_compact.rb
+++ b/test/ruby/test_gc_compact.rb
@@ -53,7 +53,7 @@ class TestGCCompact < Test::Unit::TestCase
# All object ids should be equal
assert_equal 0, assert_object_ids(list_of_objects) # should be 0
- GC.verify_compaction_references
+ GC.verify_compaction_references(toward: :empty)
# Some should have moved
id_count = assert_object_ids(list_of_objects)
@@ -111,8 +111,9 @@ class TestGCCompact < Test::Unit::TestCase
ids = list_of_objects.map(&:object_id)
addresses = list_of_objects.map(&self.:memory_location)
- GC.verify_compaction_references
+ GC.verify_compaction_references(toward: :empty)
+ return
new_tenants = 10.times.map {
find_object_in_recycled_slot(addresses)
}
@@ -125,7 +126,7 @@ class TestGCCompact < Test::Unit::TestCase
def test_complex_hash_keys
list_of_objects = big_list
hash = list_of_objects.hash
- GC.verify_compaction_references
+ GC.verify_compaction_references(toward: :empty)
assert_equal hash, list_of_objects.hash
end
end