Skip to content

Commit 9de7b55

Browse files
author
njn
committed
Add a bit more to Massif's manual chapter.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10708 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent d19d4ab commit 9de7b55

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

massif/docs/ms-manual.xml

+73
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ ms_print support.</para>
501501

502502
</sect2>
503503

504+
504505
<sect2 id="ms-manual.forkingprograms" xreflabel="Forking Programs">
505506
<title>Forking Programs</title>
506507
<para>If your program forks, the child will inherit all the profiling data that
@@ -512,6 +513,66 @@ the outputs from the parent and child will be intermingled in a single output
512513
file, which will almost certainly make it unreadable by ms_print.</para>
513514
</sect2>
514515

516+
517+
<sect2 id="ms-manual.not-measured"
518+
xreflabel="Memory Allocations Not Measured by Massif">
519+
<title>Memory Allocations Not Measured by Massif</title>
520+
<para>
521+
It is worth emphasising that Massif measures only heap memory, i.e. memory
522+
allocated with
523+
<function>malloc</function>,
524+
<function>calloc</function>,
525+
<function>realloc</function>,
526+
<function>memalign</function>,
527+
<function>new</function>,
528+
<function>new[]</function>,
529+
and a few other, similar functions. (And it can optionally measure stack
530+
memory, of course.) This means it does <emphasis>not</emphasis> directly
531+
measure memory allocated with lower-level system calls such as
532+
<function>mmap</function>,
533+
<function>mremap</function>, and
534+
<function>brk</function>.
535+
</para>
536+
537+
<para>
538+
Heap allocation functions such as <function>malloc</function> are built on
539+
top of these system calls. For example, when needed, an allocator will
540+
typically call <function>mmap</function> to allocate a large chunk of
541+
memory, and then hand over pieces of that memory chunk to the client program
542+
in response to calls to <function>malloc</function> et al. Massif directly
543+
measures only these higher-level <function>malloc</function> et al calls,
544+
not the lower-level system calls.
545+
</para>
546+
547+
<para>
548+
Furthermore, a client program may use these lower-level system calls
549+
directly to allocate memory. Massif does not measure these. Nor does it
550+
measure the size of code, data and BSS segments. Therefore, the numbers
551+
reported by Massif may be significantly smaller than those reported by tools
552+
such as <filename>top</filename> that measure a program's total size in
553+
memory.
554+
</para>
555+
556+
</sect2>
557+
558+
559+
<sect2 id="ms-manual.acting" xreflabel="Action on Massif's Information">
560+
<title>Acting on Massif's Information</title>
561+
<para>Massif's information is generally fairly easy to act upon. The
562+
obvious place to start looking is the peak snapshot.</para>
563+
564+
<para>It can also be useful to look at the overall shape of the graph, to
565+
see if memory usage climbs and falls as you expect; spikes in the graph
566+
might be worth investigating.</para>
567+
568+
<para>The detailed snapshots can get quite large. It is worth viewing them
569+
in a very wide window. It's also a good idea to view them with a text
570+
editor. That makes it easy to scroll up and down while keeping the cursor
571+
in a particular column, which makes following the allocation chains easier.
572+
</para>
573+
574+
</sect2>
575+
515576
</sect1>
516577

517578

@@ -708,6 +769,18 @@ file, which will almost certainly make it unreadable by ms_print.</para>
708769
</sect1>
709770

710771

772+
<sect1 id="ms-manual.clientreqs" xreflabel="Client requests">
773+
<title>Massif Client Requests</title>
774+
775+
<para>Massif does not have a <filename>massif.h</filename> file, but it does
776+
implement two of the core client requests:
777+
<function>VALGRIND_MALLOCLIKE_BLOCK</function> and
778+
<function>VALGRIND_FREELIKE_BLOCK</function>. These work in the obvious
779+
way.</para>
780+
781+
</sect1>
782+
783+
711784
<sect1 id="ms-manual.ms_print-options" xreflabel="ms_print Options">
712785
<title>ms_print Options</title>
713786

0 commit comments

Comments
 (0)