Skip to content

Instantly share code, notes, and snippets.

@tiagopog
Created July 12, 2015 15:20
Show Gist options
  • Save tiagopog/e1de3b68e3b1a9a06130 to your computer and use it in GitHub Desktop.
Save tiagopog/e1de3b68e3b1a9a06130 to your computer and use it in GitHub Desktop.
Ruby - Memory profile test
require 'memory_profiler'
report = MemoryProfiler.report do
a = 0
b = 1
1_000.times do |e|
c = a + b
a = b
b = c
puts c # Check how large is the allocation of memory for String
end
end
report.pretty_print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment