Created
September 22, 2018 07:33
-
-
Save ohaddahan/c1bd9ec897b8675994f25a2101728e4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
SIZE = 10_000 | |
def dump() | |
IO.pipe { |r, w| Marshal.dump('a' * SIZE, w) } | |
end | |
def write() | |
IO.pipe { |r, w| w.write( Marshal.dump('a' * SIZE) ) } | |
end | |
MemoryProfiler.report { dump }.pretty_print(to_file: 'report_dump.txt') | |
MemoryProfiler.report { write }.pretty_print(to_file: 'report_write.txt') |
This file contains hidden or 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
Total allocated: 704 bytes (7 objects) | |
Total retained: 80 bytes (1 objects) | |
allocated memory by gem | |
----------------------------------- | |
624 other | |
80 memory_profiler-0.9.10 | |
allocated memory by file | |
----------------------------------- | |
624 (irb) | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
allocated memory by location | |
----------------------------------- | |
624 (irb):20 | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
allocated memory by class | |
----------------------------------- | |
464 IO | |
120 String | |
80 Proc | |
40 Array | |
allocated objects by gem | |
----------------------------------- | |
6 other | |
1 memory_profiler-0.9.10 | |
allocated objects by file | |
----------------------------------- | |
6 (irb) | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
allocated objects by location | |
----------------------------------- | |
6 (irb):20 | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
allocated objects by class | |
----------------------------------- | |
3 String | |
2 IO | |
1 Array | |
1 Proc | |
retained memory by gem | |
----------------------------------- | |
80 memory_profiler-0.9.10 | |
retained memory by file | |
----------------------------------- | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
retained memory by location | |
----------------------------------- | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
retained memory by class | |
----------------------------------- | |
80 Proc | |
retained objects by gem | |
----------------------------------- | |
1 memory_profiler-0.9.10 | |
retained objects by file | |
----------------------------------- | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
retained objects by location | |
----------------------------------- | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
retained objects by class | |
----------------------------------- | |
1 Proc | |
Allocated String Report | |
----------------------------------- | |
1 "" | |
1 (irb):20 | |
1 "a" | |
1 (irb):20 | |
1 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
1 (irb):20 | |
Retained String Report | |
----------------------------------- |
This file contains hidden or 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
Total allocated: 17168 bytes (9 objects) | |
Total retained: 80 bytes (1 objects) | |
allocated memory by gem | |
----------------------------------- | |
17088 other | |
80 memory_profiler-0.9.10 | |
allocated memory by file | |
----------------------------------- | |
17088 (irb) | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
allocated memory by location | |
----------------------------------- | |
17088 (irb):24 | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
allocated memory by class | |
----------------------------------- | |
16584 String | |
464 IO | |
80 Proc | |
40 Array | |
allocated objects by gem | |
----------------------------------- | |
8 other | |
1 memory_profiler-0.9.10 | |
allocated objects by file | |
----------------------------------- | |
8 (irb) | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
allocated objects by location | |
----------------------------------- | |
8 (irb):24 | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
allocated objects by class | |
----------------------------------- | |
5 String | |
2 IO | |
1 Array | |
1 Proc | |
retained memory by gem | |
----------------------------------- | |
80 memory_profiler-0.9.10 | |
retained memory by file | |
----------------------------------- | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
retained memory by location | |
----------------------------------- | |
80 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
retained memory by class | |
----------------------------------- | |
80 Proc | |
retained objects by gem | |
----------------------------------- | |
1 memory_profiler-0.9.10 | |
retained objects by file | |
----------------------------------- | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb | |
retained objects by location | |
----------------------------------- | |
1 /Users/ohaddahan/.rvm/gems/ruby-2.5.0/gems/memory_profiler-0.9.10/lib/memory_profiler/reporter.rb:68 | |
retained objects by class | |
----------------------------------- | |
1 Proc | |
Allocated String Report | |
----------------------------------- | |
3 "\x04\bI\"\x02\x10'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
3 (irb):24 | |
1 "a" | |
1 (irb):24 | |
1 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
1 (irb):24 | |
Retained String Report | |
----------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment