Skip to content

Instantly share code, notes, and snippets.

@freeformz
Created October 19, 2011 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freeformz/1299662 to your computer and use it in GitHub Desktop.
Save freeformz/1299662 to your computer and use it in GitHub Desktop.
def work
@count += 1
GC.start
before = Hash.new(0)
ObjectSpace.each_object { |o| before[o.class] += 1 }
super
GC.start
after = Hash.new(0)
ObjectSpace.each_object { |o| after[o.class] += 1 }
p "count: #{@count}"
after.each do |a|
p "#{a[0]}: #{a[1] - before[a[0]]} (#{a[1]})" unless (a[1] - before[a[0]]) == 0
end
p '-------------------'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment