# File lib/mini_profiler/gc_profiler.rb, line 8 def object_space_stats stats = Hash.new(0).compare_by_identity ids = Hash.new.compare_by_identity @ignore << stats.__id__ @ignore << ids.__id__ ObjectSpace.each_object { |o| begin stats[o.class] += 1 ids[o.__id__] = o if Integer === o.__id__ rescue NoMethodError # protect against BasicObject end } @ignore.each do |id| if ids.delete(id) klass = ObjectSpace._id2ref(id).class stats[klass] -= 1 end end result = {:stats => stats, :ids => ids} @ignore << result.__id__ result end