Skip to content

Instantly share code, notes, and snippets.

@authorNari
Created March 18, 2013 12:17
Show Gist options
  • Select an option

  • Save authorNari/5186776 to your computer and use it in GitHub Desktop.

Select an option

Save authorNari/5186776 to your computer and use it in GitHub Desktop.
% cat /tmp/a.rb
base_length = GC.stat[:heap_length]
(base_length * 10000).times{ 'a' }
GC.start
if GC.stat[:heap_length] == base_length
p heap_length: GC.stat[:heap_length], base_length: base_length
p 'success'
exit 0
else
p heap_length: GC.stat[:heap_length], base_length: base_length
p 'error'
exit 1
end
-- GC.stat導入後
% ./miniruby --disable-gem -v /tmp/a.rb
ruby 2.0.0dev (2012-11-29 trunk 38120) [x86_64-linux]
{:heap_length=>446, :base_length=>24}
"error"
-- GC.stat導入前
% ./miniruby --disable-gem -v /tmp/a.rb
ruby 2.0.0dev (2012-11-29 trunk 38120) [x86_64-linux]
{:heap_length=>24, :base_length=>24}
"success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment