Hi,
> Am on ruby 1.9.3-p551, Ubuntu 14.04, EM 1.0.7&1.0.8
> My ObjectSpace.count_objects looks like this:
>
> initially:
> {:TOTAL=>101376, :FREE=>1024, :T_OBJECT=>2497, :T_CLASS=>2644,
> :T_MODULE=>238, :T_FLOAT=>2931, :T_STRING=>50977, :T_REGEXP=>583,
> :T_ARRAY=>19595, :T_HASH=>1602, :T_STRUCT=>262, :T_BIGNUM=>913,
> :T_FILE=>6, :T_DATA=>10079, :T_MATCH=>177, :T_COMPLEX=>1,
> :T_RATIONAL=>799, :T_NODE=>6824, :T_ICLASS=>224}
> {:T_OBJECT=>78248, :T_CLASS=>1684144, :T_MODULE=>275360,
> :T_STRING=>1064583, :T_REGEXP=>390709, :T_ARRAY=>659536,
> :T_HASH=>766784, :T_STRUCT=>576, :T_FILE=>9488, :T_DATA=>14723296,
> :T_MATCH=>4880, :TOTAL=>19657604}
Not sure if this might be of help, but the following snippet should
show the class names of the objects in the system:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
obj_types = Hash.new(0)
GC.start
ObjectSpace.each_object do |obj|
typename = if (obj.respond_to?(:respond_to?) rescue nil)
if obj.respond_to? :ancestors
obj.name rescue "UnknownClass"
else
obj.class.name rescue "UnknownInstance"
end
else
"UnknownBasicObject"
end
obj_types[typename] += 1
end
obj_types.to_a.sort_by {|name, count| [-count, name]}.each {|name, count| puts "#{count}\t#{name}"}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(Tested on ruby 2.2.4p175)
Regards,
Bill