Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mvidner/892127ace2af2abcb01ddc8d2241696e to your computer and use it in GitHub Desktop.
Save mvidner/892127ace2af2abcb01ddc8d2241696e to your computer and use it in GitHub Desktop.

Massif Basics

Valgrind is an instrumentation framework that runs a program by simulating every instruction. It has several tools. Memcheck is the original one, used for detecting memory errors. Massif is a memory profiler.

(The output it produces, example: https://gist.github.com/mvidner/4e8ed01c7dabb648a50e0dd5f0fdcc62 )

The basic invocation of Massif is simple, valgrind --tool=massif my_program its_arguments, so for YaST

# valgrind --tool=massif /usr/lib/YaST2/bin/y2start sw_single qt

Or, if we don't want to dig in the startup scripts, we use a bigger gun:

# valgrind --tool=massif --trace-children=yes yast2 sw_single

That writes out massif.out.99999 where 99999 is process ID. To make them somewhat more readable, use the included tool ms_print which adds an ASCII graph and computes percentages:

ms_print massif.out.19015 >  massif.out.19015.txt

Debuginfo

The backtraces will contain some names, at the boundaries of shared libraries But to see names inside libraries Massif needs debuginfo files.

Massif at Installation Time

@mvidner
Copy link
Author

mvidner commented May 6, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment