Skip to content

Instantly share code, notes, and snippets.

@zbskii
Created September 11, 2012 17:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbskii/3699880 to your computer and use it in GitHub Desktop.
Save zbskii/3699880 to your computer and use it in GitHub Desktop.
Ruby allocations
require 'rubygems'
require 'ruby-prof'
RubyProf.measure_mode = RubyProf::ALLOCATIONS
RubyProf.start
1_000_000.times{ Array.new(10) }
result = RubyProf.stop
# Print a flat profile to text
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment