Blame help/C/memory-map-use.page

Packit 76ec6a
Packit 76ec6a
      xmlns:ui="http://projectmallard.org/ui/1.0/"
Packit 76ec6a
      type="topic" style="task"
Packit 76ec6a
      id="memory-map-use">
Packit 76ec6a
Packit 76ec6a
  <info>
Packit 76ec6a
    <revision pkgversion="3.11" date="2014-01-28" status="candidate"/>
Packit 76ec6a
    <link type="guide" xref="index#memory" group="memory" />
Packit 76ec6a
Packit 76ec6a
    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
Packit 76ec6a
Packit 76ec6a
    <credit type="author copyright">
Packit 76ec6a
      <name>Phil Bull</name>
Packit 76ec6a
      <email>philbull@gmail.com</email>
Packit 76ec6a
      <years>2011</years>
Packit 76ec6a
    </credit>
Packit 76ec6a
Packit 76ec6a
    <credit type="author copyright">
Packit 76ec6a
      <name>Michael Hill</name>
Packit 76ec6a
      <email>mdhillca@gmail.com</email>
Packit 76ec6a
      <years>2011, 2014</years>
Packit 76ec6a
    </credit>
Packit 76ec6a
Packit 76ec6a
    <desc>View the memory map of a process.</desc>
Packit 76ec6a
  </info>
Packit 76ec6a
Packit 76ec6a
  <title>Using memory maps</title>
Packit 76ec6a
Packit 76ec6a
  <comment>
Packit 76ec6a
    Phil Bull
Packit 76ec6a
    

Explain how to use the Memory Map feature.

Packit 76ec6a
  </comment>
Packit 76ec6a
Packit 76ec6a
  

<gui>Virtual memory</gui> is a representation of the combined

Packit 76ec6a
  <gui>physical memory</gui> and <link xref="mem-swap">swap space</link> in a
Packit 76ec6a
  system. It enables running processes to access more than the
Packit 76ec6a
  existing physical memory by <gui>mapping</gui> locations in physical memory
Packit 76ec6a
  to files on disk. When the system needs more pages of memory than are
Packit 76ec6a
  available, some of the existing pages will be paged out or written
Packit 76ec6a
  to the swap space.

Packit 76ec6a
Packit 76ec6a
  

The <gui>memory map</gui> displays the total virtual memory use of the

Packit 76ec6a
  process, and can be used to determine the memory cost of running a single or
Packit 76ec6a
  multiple instances of the program, to ensure the use of the correct shared
Packit 76ec6a
  libraries, to see the results of adjusting various performance tuning
Packit 76ec6a
  parameters the program may have, or to diagnose issues such as memory
Packit 76ec6a
  leaks.

Packit 76ec6a
Packit 76ec6a
  

To display the <link xref="memory-map-what">memory map</link> of a

Packit 76ec6a
  process:

Packit 76ec6a
Packit 76ec6a
  <steps>
Packit 76ec6a
    <item>

Click the <gui>Processes</gui> tab.

</item>
Packit 76ec6a
    <item>

Right click the desired process in the <gui>process list</gui>.

</item>
Packit 76ec6a
    <item>

Click <gui>Memory Maps</gui>.

</item>
Packit 76ec6a
  </steps>
Packit 76ec6a
Packit 76ec6a
<section id="read">
Packit 76ec6a
  <title>Reading the memory map</title>
Packit 76ec6a
Packit 76ec6a
  <list>
Packit 76ec6a
    <item>
Packit 76ec6a
      

Addresses are diplayed in hexadecimal (base 16).

Packit 76ec6a
    </item>
Packit 76ec6a
    <item>
Packit 76ec6a
      

Sizes are displayed in <link xref="units">IEC binary

Packit 76ec6a
      prefixes</link>.

Packit 76ec6a
    </item>
Packit 76ec6a
    <item>
Packit 76ec6a
      

At runtime the process can allocate more memory dynamically into an

Packit 76ec6a
      area called the heap, and store arguments and variables into
Packit 76ec6a
      another area called the stack.

Packit 76ec6a
    </item>
Packit 76ec6a
    <item>
Packit 76ec6a
      

The program itself and each of the shared libraries has three entries

Packit 76ec6a
      each, one for the read-execute text segment, one for the read-write data
Packit 76ec6a
      segment and one for a read-only data segment. Both data segments need to
Packit 76ec6a
      be paged out at swap time.

Packit 76ec6a
    </item>
Packit 76ec6a
  </list>
Packit 76ec6a
Packit 76ec6a
Packit 76ec6a
<title>Properties</title>
Packit 76ec6a
  
Packit 76ec6a
	  

Filename

Packit 76ec6a
	  

The location of a shared library that is currently used by the

Packit 76ec6a
    process. If this field is blank, the memory information in this row
Packit 76ec6a
    describes memory that is owned by the process whose name is displayed above
Packit 76ec6a
    the memory-map table.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

VM Start

Packit 76ec6a
	  

The address at which the memory segment begins. VM Start, VM End and

Packit 76ec6a
    VM Offset together specify the location on disk to which the shared library
Packit 76ec6a
    is mapped.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

VM End

Packit 76ec6a
	  

The address at which the memory segment ends.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

VM Size

Packit 76ec6a
	  

The size of the memory segment.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

Flags

Packit 76ec6a
	  

The following flags describe the different types of memory-segment

Packit 76ec6a
    access that the process can have:

Packit 76ec6a
    <terms>
Packit 76ec6a
      <item>
Packit 76ec6a
        <title><gui>p</gui></title>
Packit 76ec6a
        

The memory segment is private to the process, and is not accessible

Packit 76ec6a
        to other processes.

Packit 76ec6a
      </item>
Packit 76ec6a
      <item>
Packit 76ec6a
        <title><gui>r</gui></title>
Packit 76ec6a
        

The process has permission to read from the memory segment.

Packit 76ec6a
      </item>
Packit 76ec6a
      <item>
Packit 76ec6a
        <title><gui>s</gui></title>
Packit 76ec6a
        

The memory segment is shared with other processes.

Packit 76ec6a
      </item>
Packit 76ec6a
      <item>
Packit 76ec6a
        <title><gui>w</gui></title>
Packit 76ec6a
        

The process has permission to write into the memory segment.

Packit 76ec6a
      </item>
Packit 76ec6a
      <item>
Packit 76ec6a
        <title><gui>x</gui></title>
Packit 76ec6a
        

The process has permission to execute instructions that are

Packit 76ec6a
        contained within the memory segment.

Packit 76ec6a
      </item>
Packit 76ec6a
    </terms>
Packit 76ec6a
    
Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

VM Offset

Packit 76ec6a
	  

The location of the address within the memory segment,

Packit 76ec6a
    measured from VM Start.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

Private, Shared, Clean, Dirty

Packit 76ec6a
Packit 76ec6a
  be written to swap since they can be re-loaded from their original location
Packit 76ec6a
  on disk. Data pages have read-write permissions, and if modified when in
Packit 76ec6a
  memory, they are labeled dirty, and when designated for swapping,
Packit 76ec6a
  must be paged out.

Packit 76ec6a
-->
Packit 76ec6a
          <list><item>

private pages are accessed by one

Packit 76ec6a
  process

</item>
Packit 76ec6a
          <item>

shared pages can be accessed by more than

Packit 76ec6a
  one process

</item>
Packit 76ec6a
          <item>

clean pages have not yet been modified

Packit 76ec6a
  while in memory and can be discarded when designated to be swapped
Packit 76ec6a
  out

</item>
Packit 76ec6a
          <item>

dirty pages have been modified while in

Packit 76ec6a
  memory and must be written to disk when designated to be swapped
Packit 76ec6a
  out

</item></list>
Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

Device

Packit 76ec6a
	  

The major and minor numbers of the device on which the shared

Packit 76ec6a
    library filename is located. Together these specify a partition on the
Packit 76ec6a
    system.

Packit 76ec6a
  
Packit 76ec6a
  
Packit 76ec6a
	  

Inode

Packit 76ec6a
	  

The inode on the device from which the shared library location

Packit 76ec6a
    is loaded into memory. An inode is the structure the filesystem uses to
Packit 76ec6a
    store a file, and the number assigned to it is unique.

Packit 76ec6a
  
Packit 76ec6a
Packit 76ec6a
Packit 76ec6a
</section>
Packit 76ec6a
</page>