Skip to content

Commit

Permalink
Ruby 3.2 deprecates double_heap option to `GC.verify_compaction_ref…
Browse files Browse the repository at this point in the history
…erences` (#1365)

This commit uses newly supported `expand_heap` option if Ruby version is 3.2 or higher.

- Warning message fixed by this commit:
```
$ bundle exec rake spec
... snip ...
<internal:gc>:286: warning: double_heap is deprecated, please use expand_heap instead
... snip ...
```

Refer to ruby/ruby@a6dd859
  • Loading branch information
yahonda authored May 6, 2024
1 parent 43ea8af commit 936aec3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
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 RUBY_VERSION >= "3.2"
GC.verify_compaction_references(expand_heap: true, toward: :empty)
else
GC.verify_compaction_references(double_heap: true, toward: :empty)
end
end

RSpec.configure do |config|
Expand Down

0 comments on commit 936aec3

Please sign in to comment.