Skip to content

Instantly share code, notes, and snippets.

@wuputah
Created February 14, 2009 20: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 wuputah/64450 to your computer and use it in GitHub Desktop.
Save wuputah/64450 to your computer and use it in GitHub Desktop.
>> ObjectSpace.each_object { }
=> 12212
>> ObjectSpace.each_object { }
=> 12465
>> ObjectSpace.each_object { }
=> 12718
>> ObjectSpace.each_object { }
=> 12971
>> ObjectSpace.each_object { }
=> 13224
>> ObjectSpace.each_object { }
=> 13477
>> count = nil
=> nil
>> 1_000_000.times do
?> String.new
>> c = ObjectSpace.each_object { }
>> count ||= c
>> if c < count
>> puts "GC - new object count is #{c}"
>> end
>> count = c
>> end
GC - new object count is 5380
GC - new object count is 5381
GC - new object count is 5381
GC - new object count is 5379
GC - new object count is 5380
GC - new object count is 5380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment