Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
GC.latest_gc_info
(?::Hash[::Symbol, untyped]? hash) -> ::Hash[::Symbol, untyped]
(::Symbol key) -> untyped
GC.latest_gc_info → hash
GC.latest_gc_info(hash) → hash
GC.latest_gc_info(key) → value
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/gc.rb, line 346
def self.latest_gc_info hash_or_key = nil
if hash_or_key == nil
hash_or_key = {}
elsif Primitive.cexpr!("RBOOL(!SYMBOL_P(hash_or_key) && !RB_TYPE_P(hash_or_key, T_HASH))")
raise TypeError, "non-hash or symbol given"
end
Primitive.cstmt! %{
return rb_gc_latest_gc_info(hash_or_key);
}
end
Returns information about the most recent garbage collection.
If the argument hash is given and is a Hash object, it is overwritten and returned. This is intended to avoid the probe effect.
If the argument key is given and is a Symbol object, it returns the value associated with the key. This is equivalent to GC.latest_gc_info[key].
Ruby version changes
-
3.2
-
Expose
need_major_gcviaGC.latest_gc_info. GH-6791
-
See also
.enable
.measure_total_time
.disable
.measure_total_time=
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0