Created
August 21, 2012 23:26
-
-
Save bil-bas/3420409 to your computer and use it in GitHub Desktop.
Count objects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all objects where there are > 1 instance | |
h = Hash.new(0) | |
ObjectSpace.each_object {|o| h[o.class] += 1 } | |
h.select {|k, v| v > 1 }.sort_by {|k, v| -v }.each {|k, v| puts "#{k}: #{v}" }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment