End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
GC.stat_heap
# File tmp/rubies/ruby-3.2.0/gc.rb, line 217
def self.stat_heap heap_name = nil, hash_or_key = nil
Primitive.gc_stat_heap heap_name, hash_or_key
end
Returns information for memory pools in the GC.
If the first optional argument, heap_name, is passed in and not nil, it returns a Hash containing information about the particular memory pool. Otherwise, it will return a Hash with memory pool names as keys and a Hash containing information about the memory pool as values.
If the second optional argument, hash_or_key, is given as Hash, it will be overwritten and returned. This is intended to avoid the probe effect.
If both optional arguments are passed in and the second optional argument is a symbol, it will return a Numeric of the value for the particular memory pool.
On CRuby, heap_name is of the type Integer but may be of type String on other implementations.
The contents of the hash are implementation specific and may change in the future without notice.
If the optional argument, hash, is given, it is overwritten and returned.
This method is only expected to work on CRuby.