The GC profiler provides access to information on GC runs including time, length and object space size.
Example:
GC::Profiler.enable
require 'rdoc/rdoc'
GC::Profiler.report
GC::Profiler.disable
See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations