Commit 6e9f0809 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Disable GC compacting via monkey patch

parent c19699f1
---
title: Temporary make `GC.compact` no-op
merge_request: 56079
author:
type: changed
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# Disables `GC.compact` method via monkey-patching.
# This is temporary measure to deal with reguarly appearing compacting issues (resulting in segfaults) in external gems.
# Having this patch allow using `nakayoshi_fork` in `config/puma.rb`,
# only without `GC.compact` (still invoking 4 GC cycles).
# Refer to for details: https://github.com/puma/puma/blob/80274413b04fae77cac7a7fecab7d6e89204343b/lib/puma/util.rb#L27
module NakayoshiForkCompacting
module MonkeyPatch
def compact
puts 'Note: GC compacting is currently disabled.'\
' Refer to `config/initializers_before_autoloader/003_gc_compact.rb` for details.'
end
end
end
GC.singleton_class.prepend NakayoshiForkCompacting::MonkeyPatch
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment