Created
July 12, 2015 15:20
-
-
Save tiagopog/e1de3b68e3b1a9a06130 to your computer and use it in GitHub Desktop.
Ruby - Memory profile test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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