Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
GC.enable
() -> bool
GC.enable → true or false
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/gc.rb, line 83
def self.enable
Primitive.gc_enable
end
Enables garbage collection; returns whether garbage collection was disabled:
Example
GC.disable GC.enable # => true GC.enable # => false
See also
.disable
.latest_compact_info
.count
.latest_gc_info
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0