| 1 |
<page xmlns="http://projectmallard.org/1.0/" |
| 2 |
xmlns:ui="http://projectmallard.org/ui/1.0/" |
| 3 |
type="topic" style="task" |
| 4 |
id="memory-map-use"> |
| 5 |
|
| 6 |
<info> |
| 7 |
<revision pkgversion="3.11" date="2014-01-28" status="candidate"/> |
| 8 |
<link type="guide" xref="index#memory" group="memory" /> |
| 9 |
|
| 10 |
<include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/> |
| 11 |
|
| 12 |
<credit type="author copyright"> |
| 13 |
<name>Phil Bull</name> |
| 14 |
<email>[email protected]</email> |
| 15 |
<years>2011</years> |
| 16 |
</credit> |
| 17 |
|
| 18 |
<credit type="author copyright"> |
| 19 |
<name>Michael Hill</name> |
| 20 |
<email>[email protected]</email> |
| 21 |
<years>2011, 2014</years> |
| 22 |
</credit> |
| 23 |
|
| 24 |
<desc>View the memory map of a process.</desc> |
| 25 |
</info> |
| 26 |
|
| 27 |
<title>Using memory maps</title> |
| 28 |
|
| 29 |
<comment> |
| 30 |
<cite date="2011-06-18" href="mailto:[email protected]">Phil Bull</cite> |
| 31 |
<p>Explain how to use the Memory Map feature.</p> |
| 32 |
</comment> |
| 33 |
|
| 34 |
<p><gui>Virtual memory</gui> is a representation of the combined |
| 35 |
<gui>physical memory</gui> and <link xref="mem-swap">swap space</link> in a |
| 36 |
system. It enables running processes to access <em>more</em> than the |
| 37 |
existing physical memory by <gui>mapping</gui> locations in physical memory |
| 38 |
to files on disk. When the system needs more pages of memory than are |
| 39 |
available, some of the existing pages will be <em>paged out</em> or written |
| 40 |
to the swap space.</p> |
| 41 |
|
| 42 |
<p>The <gui>memory map</gui> displays the total virtual memory use of the |
| 43 |
process, and can be used to determine the memory cost of running a single or |
| 44 |
multiple instances of the program, to ensure the use of the correct shared |
| 45 |
libraries, to see the results of adjusting various performance tuning |
| 46 |
parameters the program may have, or to diagnose issues such as memory |
| 47 |
leaks.</p> |
| 48 |
|
| 49 |
<p>To display the <link xref="memory-map-what">memory map</link> of a |
| 50 |
process:</p> |
| 51 |
|
| 52 |
<steps> |
| 53 |
<item><p>Click the <gui>Processes</gui> tab.</p></item> |
| 54 |
<item><p>Right click the desired process in the <gui>process list</gui>.</p></item> |
| 55 |
<item><p>Click <gui>Memory Maps</gui>.</p></item> |
| 56 |
</steps> |
| 57 |
|
| 58 |
<section id="read"> |
| 59 |
<title>Reading the memory map</title> |
| 60 |
|
| 61 |
<list> |
| 62 |
<item> |
| 63 |
<p>Addresses are displayed in hexadecimal (base 16).</p> |
| 64 |
</item> |
| 65 |
<item> |
| 66 |
<p>Sizes are displayed in <link xref="units">IEC binary |
| 67 |
prefixes</link>.</p> |
| 68 |
</item> |
| 69 |
<item> |
| 70 |
<p>At runtime the process can allocate more memory dynamically into an |
| 71 |
area called the <em>heap</em>, and store arguments and variables into |
| 72 |
another area called the <em>stack</em>.</p> |
| 73 |
</item> |
| 74 |
<item> |
| 75 |
<p>The program itself and each of the shared libraries has three entries |
| 76 |
each, one for the read-execute text segment, one for the read-write data |
| 77 |
segment and one for a read-only data segment. Both data segments need to |
| 78 |
be paged out at swap time.</p> |
| 79 |
</item> |
| 80 |
</list> |
| 81 |
|
| 82 |
<table shade="rows" ui:expanded="false"> |
| 83 |
<title>Properties</title> |
| 84 |
<tr> |
| 85 |
<td><p>Filename</p></td> |
| 86 |
<td><p>The location of a shared library that is currently used by the |
| 87 |
process. If this field is blank, the memory information in this row |
| 88 |
describes memory that is owned by the process whose name is displayed above |
| 89 |
the memory-map table.</p></td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<td><p>VM Start</p></td> |
| 93 |
<td><p>The address at which the memory segment begins. VM Start, VM End and |
| 94 |
VM Offset together specify the location on disk to which the shared library |
| 95 |
is mapped.</p></td> |
| 96 |
</tr> |
| 97 |
<tr> |
| 98 |
<td><p>VM End</p></td> |
| 99 |
<td><p>The address at which the memory segment ends.</p></td> |
| 100 |
</tr> |
| 101 |
<tr> |
| 102 |
<td><p>VM Size</p></td> |
| 103 |
<td><p>The size of the memory segment.</p></td> |
| 104 |
</tr> |
| 105 |
<tr> |
| 106 |
<td><p>Flags</p></td> |
| 107 |
<td><p>The following flags describe the different types of memory-segment |
| 108 |
access that the process can have:</p> |
| 109 |
<terms> |
| 110 |
<item> |
| 111 |
<title><gui>p</gui></title> |
| 112 |
<p>The memory segment is private to the process, and is not accessible |
| 113 |
to other processes.</p> |
| 114 |
</item> |
| 115 |
<item> |
| 116 |
<title><gui>r</gui></title> |
| 117 |
<p>The process has permission to read from the memory segment.</p> |
| 118 |
</item> |
| 119 |
<item> |
| 120 |
<title><gui>s</gui></title> |
| 121 |
<p>The memory segment is shared with other processes.</p> |
| 122 |
</item> |
| 123 |
<item> |
| 124 |
<title><gui>w</gui></title> |
| 125 |
<p>The process has permission to write into the memory segment.</p> |
| 126 |
</item> |
| 127 |
<item> |
| 128 |
<title><gui>x</gui></title> |
| 129 |
<p>The process has permission to execute instructions that are |
| 130 |
contained within the memory segment.</p> |
| 131 |
</item> |
| 132 |
</terms> |
| 133 |
</td> |
| 134 |
</tr> |
| 135 |
<tr> |
| 136 |
<td><p>VM Offset</p></td> |
| 137 |
<td><p>The location of the address within the memory segment, |
| 138 |
measured from VM Start.</p></td> |
| 139 |
</tr> |
| 140 |
<tr> |
| 141 |
<td><p>Private, Shared, Clean, Dirty</p></td> |
| 142 |
<!-- <td><p>Text pages are flagged read-execute in memory and don't need to |
| 143 |
be written to swap since they can be re-loaded from their original location |
| 144 |
on disk. Data pages have read-write permissions, and if modified when in |
| 145 |
memory, they are labeled <em>dirty</em>, and when designated for swapping, |
| 146 |
must be paged out.</p></td> |
| 147 |
--> |
| 148 |
<td><list><item><p><em>private</em> pages are accessed by one |
| 149 |
process</p></item> |
| 150 |
<item><p><em>shared</em> pages can be accessed by more than |
| 151 |
one process</p></item> |
| 152 |
<item><p><em>clean</em> pages have not yet been modified |
| 153 |
while in memory and can be discarded when designated to be swapped |
| 154 |
out</p></item> |
| 155 |
<item><p><em>dirty</em> pages have been modified while in |
| 156 |
memory and must be written to disk when designated to be swapped |
| 157 |
out</p></item></list></td> |
| 158 |
</tr> |
| 159 |
<tr> |
| 160 |
<td><p>Device</p></td> |
| 161 |
<td><p>The major and minor numbers of the device on which the shared |
| 162 |
library filename is located. Together these specify a partition on the |
| 163 |
system.</p></td> |
| 164 |
</tr> |
| 165 |
<tr> |
| 166 |
<td><p>Inode</p></td> |
| 167 |
<td><p>The inode on the device from which the shared library location |
| 168 |
is loaded into memory. An inode is the structure the filesystem uses to |
| 169 |
store a file, and the number assigned to it is unique.</p></td> |
| 170 |
</tr> |
| 171 |
</table> |
| 172 |
|
| 173 |
</section> |
| 174 |
</page> |