From 8d4e7410797023dffe0d472a133cbfb1b4186ab6 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Mon, 25 Jan 2021 10:01:49 +0100 Subject: [PATCH] Run GC.verify_compaction_references on CI --- spec/spec_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 08b660b89..b0bf598aa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,12 @@ require 'yaml' DatabaseCredentials = YAML.load_file('spec/configuration.yml') +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) +end + RSpec.configure do |config| config.disable_monkey_patching!