Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
GC.disable
() -> bool
GC.disable → true or false
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/gc.rb, line 97
def self.disable
Primitive.gc_disable
end
Disables garbage collection (but GC.start remains potent): returns whether garbage collection was already disabled.
Example
GC.enable GC.disable # => false GC.disable # => true