.TH "HEAPY" "1" "September 2018" "" .SH "NAME" .B "heapy " - CLI for analyzing Ruby Heap dumps .SH "SYNOPSIS" .B "heapy read " [file|command] [number|all] .SH "DESCRIPTION" .B "heapy " is a CLI for analyzing Heap dumps in Ruby. Start analyzing heap dumps of a command or files by: .IP "" 4 $ .B "heapy read " [file|command] .IP "" 0 Dumps from Ruby command can be analyzed by, .IP "" 4 $ .B "heapy read " .IP "" 0 Heap dumps from files can also be analayzed, .IP "" 4 $ .B "heapy read " file.dump \Generation: nil object count: 209191 \Generation: 18 object count: 805 .IP "" 0 .B "NOTE:" The reason of getting a "nil" generation is these objects were loaded into memory before your code began tracking the allocations\. To ensure all allocations are tracked one should execute the ruby script this trick\. .P First create a file \fBtrace\.rb\fR that only starts allocation tracing: .IP "" 4 require \'objspace\' ObjectSpace\.trace_object_allocations_start .IP "" 0 Now make sure this command is loaded before running the script, use Ruby\'s \fB\-I\fR to specify a load path and \fB\-r\fR to specify a library to require, in this case the trace file, .IP "" 4 $ .B "ruby" \-I \./ \-r trace script_name\.rb .IP "" 0 If the last line of file is invalid JSON, make sure that file is closed file after writing the ruby heap dump to it\. To analyze a specific generation, pass the generation number along with the command. For example, to analyze 17th generation in file.dump, .IP "" 4 $ .B "heapy read " file.dump 17 .IP "" 0 To get all generations pass "all" directive .IP "" 4 $ .B "heapy read " file.dump all .SH "AUTHORS" Heapy was written by Richard Schneeman. Initial code and idea was developed by Sam Saffron.