End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
GC.compact
GC.compact
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/gc.rb, line 212
def self.compact
Primitive.gc_compact
end
This function compacts objects together in Ruby’s heap. It eliminates unused space (or fragmentation) in the heap by moving objects in to that unused space. This function returns a hash which contains statistics about which objects were moved. See GC.latest_gc_info for details about compaction statistics.
This method is implementation specific and not expected to be implemented in any implementation besides MRI.