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
The backtraces will contain some names, at the boundaries of shared libraries But to see names inside libraries Massif needs debuginfo files.
- Install Massif itself (easy)
- Install Debuginfo
- Find the relevant packages
- Make sure the version matches
- Modify the startup/YaST2.call script (PR 935) to
- call Massif, if MASSIF=1
- Put the logs where save_y2logs expects them
Superseded by https://github.com/yast/yast-installation/blob/44835c83560a9820df424ca88cc0f32c90e5abbf/doc/memory-profile-valgrind-massif.md