Skip to content

Instantly share code, notes, and snippets.

@jeremy
Created March 23, 2009 08:32
Show Gist options
  • Save jeremy/83469 to your computer and use it in GitHub Desktop.
Save jeremy/83469 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class FooArray < Array; end
a = FooArray.new(1000000){'a'}
a = nil
GC.start
count = ObjectSpace.each_object(FooArray) {}
puts "#{count} objects remain after garbage collection"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment