Skip to content

Instantly share code, notes, and snippets.

@IlkhamGaysin
Last active March 17, 2017 15:12
Show Gist options
  • Save IlkhamGaysin/a8fba9fe76bec4fea665bdfdaec5973b to your computer and use it in GitHub Desktop.
Save IlkhamGaysin/a8fba9fe76bec4fea665bdfdaec5973b to your computer and use it in GitHub Desktop.

To count objects in current thread you can use this approach.

class OtherKlass
end

OtherKlass.new
OtherKlass.new

ObjectSpace.each_object(OtherKlass){} # => 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment