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 amount of memory used to store your program’s machine code instructions. The text segment is sometimes called the code segment. 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. 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. 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. dmstat is sensitive to the focus. Note this four-process program:
Rogue Wave Software, Inc. |
Voice: (303) 473-9118 |
rwonlinedocs@roguewave.com |