Skip to content

Commit

Permalink
fix: use expand_heap for Ruby 3.2.0+
Browse files Browse the repository at this point in the history
Summary

Starting Ruby 3.2.0 `GC.verify_compaction_references(expand_heap: true, toward: :empty)` should be used instead of `GC.verify_compaction_references(double_heap: true, toward: :empty)`.

Before:

```shell
ruby -Ilib:test test/geos_capi/polygon_test.rb
<internal:gc>:251: warning: double_heap is deprecated, please use expand_heap instead
  # ...
```

After:

```shell
ruby -Ilib:test test/geos_capi/polygon_test.rb
  # ...
```
  • Loading branch information
oleksii-leonov committed Dec 2, 2023
1 parent 9829ded commit 0fc7374
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def geos_version_match(requirement)
# Static test for missed references in our CAPI codebase (or FFI interface).
# See https://alanwu.space/post/check-compaction/
if defined?(GC.verify_compaction_references) == "method"
GC.verify_compaction_references(double_heap: true, toward: :empty)
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0")
GC.verify_compaction_references(expand_heap: true, toward: :empty)
else
GC.verify_compaction_references(double_heap: true, toward: :empty)
end
end

# Live test for our implementation of Ruby's compaction methods (rb_gc_mark_movable
Expand Down

0 comments on commit 0fc7374

Please sign in to comment.