End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
GC.latest_compact_info
GC.latest_compact_info → {:considered=>{:T_CLASS=>11}, :moved=>{:T_CLASS=>11}}
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/gc.rb, line 223
def self.latest_compact_info
Primitive.gc_compact_stats
end
Returns information about object moved in the most recent GC compaction.
The returned hash has two keys :considered and :moved. The hash for :considered lists the number of objects that were considered for movement by the compactor, and the :moved hash lists the number of objects that were actually moved. Some objects can’t be moved (maybe they were pinned) so these numbers can be used to calculate compaction efficiency.