Project

heapviz

0.0
No release in over a year
Visualise a Ruby heap dump output from ObjectSpace.dump_all
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.4.0
~> 1.13.0
~> 13.0.0

Runtime

~> 1.4.0
 Project Readme

Heapviz

Produces a png of a json dump of the Ruby objspace. Heap dump images are organised in rows and columns:

  • A heap page is a vertical column 4 pixels wide
  • A slot is a vertical chunk that is 4 pixels wide and (4*slot_size/sizeof(RVALUE)) tall. so 40 byte slots are 4x4 pixels, 80 bytes slots are 4x8 pixels, 160 bytes are 4x16 pixels and so on.

Running

This script requires Ruby >= 3.2.0

require 'objspace'
ObjectSpace.dump_all(output: File.new("output.json", "w"))

Run it with Ruby

./ruby test.rb

Then run this script with your json output, and a filename of a png to write to (the png doesn't need to exist)

../heapviz/exe/heapviz output.json output.png
open output.png