To count objects in current thread you can use this approach.
class OtherKlass
end
OtherKlass.new
OtherKlass.new
ObjectSpace.each_object(OtherKlass){} # => 2
To count objects in current thread you can use this approach.
class OtherKlass
end
OtherKlass.new
OtherKlass.new
ObjectSpace.each_object(OtherKlass){} # => 2