vmmap(1)                System General Commands Manual                vmmap(1)

NAME
     vmmap - Display the virtual memory regions allocated in a process

SYNOPSIS
     vmmap pid

DESCRIPTION
     vmmap displays the virtual memory regions allocated in a specified pro-
     cess, helping a programmer understand how memory is being used, and what
     the purposes of memory at a given address may be.

     For each region, vmmap describes the starting address, size of the region
     in kilobytes, read/write permissions for the page, sharing mode for the
     page, and the purpose of the pages.

     The size of the virtual memory region represents the virtual memory pages
     reserved, but not necessarily allocated.  For example, using the vm_allo-
     cate Mach system call reserves the pages, but physical memory won't be
     allocated for the page until the memory is actually touched.  A memory-
     mapped file may have a virtual memory page reserved, but the pages are
     not instantiated until a read or write happens.  Thus, this size may not
     correctly describe the application's true memory usage.

     The protection mode describes if the memory is readable, writable, or
     executable.  Each virtual memory region has a current permission, and a
     maximum permission.  In the line for a virtual memory region, the current
     permission is displayed first, the maximum permission second.  For exam-
     ple, The first page of an application (starting at address 0x00000000)
     permits neither reads, writes, or execution ("---"), ensuring that any
     reads or writes to address 0, or dereferences of a NULL pointer immedi-
     ately cause a bus error.  Pages representing an executable always have
     the execute and read bits set ("r-x").  The current permissions usually
     do not permit writing to the region.  However, the maximum permissions
     allow writing so that the debugger can request write access to a page to
     insert breakpoints.  Permissions for executables appear as "r-x/rwx" to
     indicate these permissions.

     The share mode describes whether pages are shared between processes,and
     what happens when pages are modified.  Private pages (PRV) are pages only
     visible to this process.  They are allocated as they are written to, and
     can be paged out to disk. Copy-on-write (COW) pages are shared by multi-
     ple processes (or shared by a single process in multiple locations).
     When the page is modified, the writing process then receives its own copy
     of the page.  Empty (NUL) sharing implies that the page does not really
     exist in physical memory.  Aliased (ALI) and shared (SHM) memory is
     shared between processes.

     The share mode typically describes the general mode controlling the
     region.  For example, as copy-on-write pages are modified, they become
     private to the application.  Even with the private pages, the region is
     still COW until all pages become private.  Once all pages are private,
     then the share mode would change to private.

     The far left column names the purpose of the memory: text segment, data
     segment, allocated via malloc, stack, etc.  For regions loaded from bina-
     ries, the far right shows the library loaded into the memory.

     Some lines in vmmap's output describe submaps.  A submap is a shared set
     of virtual memory page descriptions that the operating system can reuse
     between multiple processes.   The memory between 0x70000000 and
     0x80000000, for example, is a submap containing the most common dynamic
     libraries.  Submaps minimize the operating system's memory usage by rep-
     resenting the virtual memory regions only once.  Submaps can either be
     shared by all processes (machine-wide) or local to the process (process-
     only).  If the contents of a machine-wide submap are changed -- for exam-
     ple, the debugger makes a section of memory for a dylib writable so it
     can insert debugging traps -- then the submap becomes local, and the ker-
     nel will allocate memory to store the extra copy.

SEE ALSO
     heap(1) leaks(1)

     The mach system call vm_region retrieves the information used by vmmap.

BSD                             April 26, 2000                             BSD