HEAPY(1)

✨ HEAPY(1) ✨

okay bestie, gather round πŸ’– this is heapy, a General Commands Manual page for a little CLI that reads Ruby Heap dumps. It's giving detective energy, it's giving "where did all my objects go", and honestly? Iconic. πŸ•΅οΈβ™€οΈ


πŸŽ€ NAME πŸŽ€

heapy β€” the CLI for analyzing Ruby Heap dumps. no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

heapy read [file|command] [number|all]

πŸ’… DESCRIPTION πŸ’…

heapy is a CLI for analyzing Heap dumps in Ruby. To start analyzing heap dumps of a command or files, you literally just do:

$ heapy read [file|command]

Dumps from a Ruby command can be analyzed by:

$ heapy read <command>

And heap dumps from files can also be analyzed, like:

$ heapy read file.dump

 Generation: nil object count: 209191
 Generation:  18 object count: 805
⚠️ NOTE: the reason you're getting a nil generation is that those objects were loaded into memory before your code started tracking the allocations. So to make sure every single allocation gets tracked, you should run your ruby script with this trick. πŸ™ˆ

First, create a file trace.rb that only starts allocation tracing:

require 'objspace'

ObjectSpace.trace_object_allocations_start

Now make sure this command is loaded before you run the script β€” use Ruby's -I to specify a load path and -r to specify a library to require, which in this case is the trace file:

$ ruby -I ./ -r trace script_name.rb

Also!</purl> if the last line of the file is invalid JSON, double check that the file is actually closed after you write the ruby heap dump to it. 🫢

To analyze a specific generation, pass the generation number along with the command. For example, to analyze the 17th generation in file.dump:

$ heapy read file.dump 17

And to get all generations, pass the "all" directive:

$ heapy read file.dump all

πŸ‘‘ AUTHORS πŸ‘‘

Heapy was written by Richard Schneeman. The initial code and the idea were developed by Sam Saffron. Two legends, fr fr. 🌟


k that's the whole page bestie, mwah πŸ’‹ This was the General Commands Manual for HEAPY(1), dated September 2018 β€” so yes it's a lil vintage but she still serves. Go analyze those dumps, you absolute main character. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from