From: "mdalessio (Mike Dalessio)" Date: 2022-05-23T22:54:58+00:00 Subject: [ruby-core:108658] [Ruby master Bug#18779] `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. Issue #18779 has been updated by mdalessio (Mike Dalessio). I've submitted a pull request that addresses this behavior in the way @byroot described above: https://github.com/ruby/ruby/pull/5934 ---------------------------------------- Bug #18779: `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. https://bugs.ruby-lang.org/issues/18779#change-97702 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I received several bug report on native gems using `GC.verify_compaction_references` in their test suite. Examples: - https://github.com/msgpack/msgpack-ruby/pull/275/files - https://github.com/Shopify/bootsnap/pull/414/files I think that when `!GC_COMPACTION_SUPPORTED`, rather than raise `NotImplementedError`, we should instead define these methods as `rb_f_notimplement` like `Process.fork` on Windows. This way `GC.respond_to?(:compact)` would be a proper way to test for compaction support. Unfortunately, these methods are defined through `.rb` files with `Primitive`, and I don't know wether it's possible to check `GC_COMPACTION_SUPPORTED` from there, nor if it's possible to define a `rb_f_notimplement` method. cc @tenderlovemaking -- https://bugs.ruby-lang.org/ Unsubscribe: