Skip to content

Commit

Permalink
Use expand_heap in GC.verify_compaction_references
Browse files Browse the repository at this point in the history
As `double_heap` was deprecated in ruby/ruby@a6dd859

Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
  • Loading branch information
javierhonduco committed Aug 23, 2023
1 parent d0ef008 commit 80ba7ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contrib/ruby/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
if GC.respond_to?(:verify_compaction_references)
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
# move objects around, helping to find object movement bugs.
GC.verify_compaction_references(double_heap: true, toward: :empty)
if Gem::Version::new(RUBY_VERSION) >= Gem::Version::new("3.2.0")
# double_heap is deprecated and expand_heap is the updated argument. This change
# was introduced in:
# https://github.com/ruby/ruby/commit/a6dd859affc42b667279e513bb94fb75cfb133c1
GC.verify_compaction_references(expand_heap: true, toward: :empty)
else
GC.verify_compaction_references(double_heap: true, toward: :empty)
end
end

class TrilogyTest < Minitest::Test
Expand Down

0 comments on commit 80ba7ea

Please sign in to comment.