On this page
End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
module · Ruby 3.0
GC
1 instance methods
19 class methods
The GC module provides an interface to Ruby’s mark and sweep garbage collection mechanism.
Some of the underlying methods are also available via the ObjectSpace module.
You may obtain information about the operation of the GC through GC::Profiler.
Class methods 19
.add_stress_to_class
.auto_compact
.auto_compact=
.compact
.count
.disable
.enable
.latest_compact_info
.latest_gc_info
.malloc_allocated_size
.malloc_allocations
.remove_stress_to_class
.start
.stat
.stress
.stress=
.verify_compaction_references
.verify_internal_consistency
.verify_transient_heap_internal_consistency
Instance methods 1
Constants
internal constants
Ruby version changes 1
-
3.0
-
GC.auto_compact=andGC.auto_compacthave been added to control when compaction runs. Settingauto_compact=to true will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! [Feature #17176]
-