(2012/11/29 5:06), bitsweat (Jeremy Kemper) wrote:
> The ruby-prof gem supports object allocation profiling for 1.8.x (REE patches). The REE patches provide rb_os_allocated_objects and ObjectSpace.allocated_objects. Ideally, we would have a simple reader method like this to avoid creating lots of `GC.stat` Hash objects.

You can avoid to create Hash object using 1st parameter.

h = {}
r = 10.times.map{
  GC.stat(h); h[:heap_total_allocated_num]
}
p r #=> [2422, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2423]

-- 
// SASADA Koichi at atdot dot net