Skip to content
On this page

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

module · Ruby 3.3

GC

1 instance methods 22 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 22

Instance methods 1

Constants

Internal constants in the garbage collector.

GC build options

Ruby version changes 4

  1. 3.2
  2. 3.1
  3. 3.0
    • GC.auto_compact= and GC.auto_compact have been added to control when compaction runs. Setting auto_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]