module Rails module Internals class ObjectSpaceInfo attr_reader :counts def initialize @counts = ObjectSpace.count_objects end def total @counts[:TOTAL] end def ratios @rations ||= @counts.except(:TOTAL, :FREE).each_with_object({}) do |(key, value), hash| hash[key] = value / total.to_f end end end end end