Skip to content
Latchkey

ms_print: Render a Massif Heap Report

ms_print reads a massif.out file and prints an ASCII heap-usage graph plus a breakdown of the top allocation sites.

ms_print is the text companion to Massif. It needs no GUI, so it fits CI logs where you want a quick view of what allocated the most at peak.

What it does

ms_print parses a massif.out file and renders it as text: a timeline graph of heap size and, for each detailed snapshot, a tree of the call sites responsible for the allocations, ranked by bytes.

Common usage

Terminal
valgrind --tool=massif ./my-program
ms_print massif.out.<pid>
# save the rendered report as an artifact
ms_print massif.out.<pid> > heap-report.txt

Options

FlagWhat it does
massif.out.<pid>The Massif output file to render (positional argument)
--threshold=NOnly show allocation sites above N percent
--x=NWidth of the graph in characters
--y=NHeight of the graph in characters

In CI

Pipe ms_print output to a file and upload it as an artifact, or grep the peak snapshot line to assert a heap budget. It is text-only, so it works on headless runners where massif-visualizer cannot.

Common errors in CI

"no such file" means the massif.out path is wrong; Massif appends the pid, so the file is massif.out.<pid> unless you set --massif-out-file. An almost-empty report means the run was killed before a detailed snapshot; the program likely crashed or hit the step timeout.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →