Skip to content

Commit

Permalink
Merge pull request #117 from javierhonduco/use-new-gc-argument
Browse files Browse the repository at this point in the history
Use expand_heap in GC.verify_compaction_references
  • Loading branch information
composerinteralia authored Aug 23, 2023
2 parents d0ef008 + 80ba7ea commit fe52d3b
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 fe52d3b

Please sign in to comment.