Last active
January 26, 2021 07:56
-
-
Save fragoulis/552b9e15d71ba21b6583fe76b623dfd3 to your computer and use it in GitHub Desktop.
Getting a memory profile on a running ruby process
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
bundle exec rbtrace -p $1 -e 'Thread.new{GC.start;require "objspace";io=File.open("/tmp/ruby-heap.dump", "w"); ObjectSpace.dump_all(output: io); io.close}' | |
bundle exec rbtrace -p $1 -e 'Thread.new{require "memory_profiler"; MemoryProfiler.start}' | |
bundle exec rbtrace -p $1 -e 'Thread.new{require "memory_profiler"; MemoryProfiler.stop.pretty_print(to_file: "/tmp/memory_profiler.log", detailed_report: true, scale_bytes: true)}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment