Massif: a heap profiler
9.2.9. Acting on Massif’s Information
Massif’s information is generally fairly easy to act upon. The obvious place to start looking is the peak snapshot.
It can also be useful to look at the overall shape of the graph, to see if memory usage climbs and falls as you expect;
spikes in the graph might be worth investigating.
The detailed snapshots can get quite large. It is worth viewing them in a very wide window.
It’s also a good idea
to view them with a text editor.
That makes it easy to scroll up and down while keeping the cursor in a particular
column, which makes following the allocation chains easier.
9.3. Massif Command-line Options
Massif-specific command-line options are:
--heap=<yes|no> [default:
yes]
Specifies whether heap profiling should be done.
--heap-admin=<size> [default:
8]
If heap profiling is enabled, gives the number of administrative bytes per block to use.
This should be an estimate
of the average, since it may vary. For example, the allocator used by glibc on Linux requires somewhere between 4
to 15 bytes per block, depending on various factors.
That allocator also requires admin space for freed blocks, but
Massif cannot account for this.
--stacks=<yes|no> [default:
no]
Specifies whether stack profiling should be done.
This option slows Massif down greatly, and so is off by default.
Note that Massif assumes that the main stack has size zero at start-up. This is not true, but doing otherwise accurately
is difficult.
Furthermore, starting at zero better indicates the size of the part of the main stack that a user program
actually has control over.
--pages-as-heap=<yes|no> [default:
no]
Tells Massif to profile memory at the page level rather than at the malloc’d block level. See above for details.
--depth=<number> [default:
30]
Maximum depth of the allocation trees recorded for detailed snapshots. Increasing it will make Massif run somewhat
more slowly, use more memory, and produce bigger output files.
146