dmstat
Displays memory use information
Format 
dmstat
Arguments 
This command has no arguments
Description 
The dmstat command displays information on your program’s memory use, returning information in three parts:
*Memory usage summary: The minimum and maximum amounts of memory used by the text and data segments, the heap, and the stack, as well as the virtual memory stack usage and the virtual memory size.
*Individual process statistics: The amount of memory that each process is currently using.
*Image information: The name of the image, the image’s text size, the image’s data size, and the set of processes using the image.
The following table describes the displayed columns:
Column
Description
text
The amount of memory used to store your program’s machine code instructions. The text segment is sometimes called the code segment.
data
The amount of memory used to store initialized and uninitialized data.
heap
The amount of memory currently used for data created at run ­time; for example, calls to the malloc() function allocate space on the heap while the free() function releases it.
stack
The amount of memory used by the currently executing routine and all the routines in its backtrace. If this is a multithreaded process, TotalView shows only information for the main thread’s stack. Note that the stacks of other threads might not change over time on some architectures. On some systems, the space allocated for a thread is considered part of the heap. For example, if your main routine invokes function foo(), the stack contains two groups of information—these groups are called frames. The first frame contains the information required for the execution of your main routine, and the second, which is the current frame, contains the information needed by the foo() function. If foo() invokes the bar() function, the stack contains three frames. When foo() finishes executing, the stack contains only one frame.
stack_vm
The logical size of the stack is the difference between the current value of the stack pointer and the address from which the stack originally grew. This value can differ from the size of the virtual memory mapping in which the stack resides. For example, the mapping can be larger than the logical size of the stack if the process previously had a deeper nesting of procedure calls or made memory allocations on the stack, or it can be smaller if the stack pointer has advanced but the intermediate memory has not been touched. The stack_vm value is this size difference.
vm_size
The sum of the sizes of the mappings in the process’s address space.
Examples 
dmstat
dmstat is sensitive to the focus. Note this four-process program:
process: text data heap stack [stack_vm] vm_size
1 (9271): 1128.54K 16.15M 9976 10432 [16384]
 
image information:
image_name text data dpids
....ry/forked_mem_exampleLINUX 2524 16778479 1
/lib/i686/libpthread.so.0 32172 27948 1
/lib/i686/libc.so.6 1050688 122338 1
/lib/ld-linux.so.2 70240 10813 1
 
dfocus a dmstat
The CLI prints the following for a four-process program:
process: text data heap stack [stack_vm] vm_size
1 (9979): 1128.54K 16.15M 14072 273168 [ 278528] 17.69M
5 (9982): 1128.54K 16.15M 9976 10944 [ 16384] 17.44M
6 (9983): 1128.54K 16.15M 9976 10944 [ 16384] 17.44M
7 (9984): 1128.54K 16.15M 9976 10944 [ 16384] 17.44M
 
maximum:
1 (9979): 1128.54K 16.15M 14072 273168 [ 278528] 17.69M
minimum
5 (9982): 1128.54K 16.15M 9976 10944 [ 16384] 17.44M
 
image information:
image_name text data dpids
....ry/forked_mem_exampleLINUX 2524 16778479 1 5 6 7
/lib/i686/libpthread.so.0 32172 27948 1 5 6 7
/lib/i686/libc.so.6 1050688 122338 1 5 6 7
            /lib/ld-linux.so.2 70240 10813 1 5 6 7
Related Topics
For information on MemoryScape, see Debugging Memory Problems with MemoryScape™ in the Classic TotalView documentation