From: SASADA Koichi Date: 2012-11-29T13:56:11+09:00 Subject: [ruby-core:50296] Re: [ruby-trunk - Feature #7457] GC.stat to return "allocated object count" and "freed object count" (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