MemTool was developed to provide a more in-depth look at where memory has been allocated on a Solaris system. Using these tools, we can find out where every page of memory is, and in what proportions. MemTool is available as a downloadable, unsupported package from Sun Engineering. Note that these tools are not supported by the normal Sun support channels. The latest version of MemTool can be found at http://www.solarisinternals.com.
The MemTool package provides command-line, GUI, and character tools, as listed in Table 7-3.
Tool | Interface | Description |
---|---|---|
memps | CLI | Dumps process summary and file system cache memory (-m). |
prtmem | CLI | Displays a systemwide summary of memory allocation. |
prtswap | CLI | Displays a systemwide detailed description of swap allocation. Both virtual and physical swap allocation are shown. |
memtool | GUI | Is a comprehensive GUI for UFS and process memory. |
mem | CUI | Is a Curses interface for UFS and process memory. |
MemTool provides three command-line tools: prtmem, memps, and prtswap.
The prtmem command shows a systemwide summary of memory utilization, categorized into seven major groups. The output from the prtmem command is shown below; the rows are described in Table 7-4.
# prtmem
Total memory: 241 Megabytes
Kernel Memory: 39 Megabytes
Application: 106 Megabytes
Executable & libs: 36 Megabytes
File Cache: 3 Megabytes
Free, file cache: 58 Megabytes
Free, free: 0 Megabytes
Row | Description |
---|---|
Total memory | The total amount of usable memory in the system minus that used for low-level memory management. |
Kernel Memory | Memory used for the kernel executable, data structures, and kernel allocations, internal to the operating system. |
Application | Anonymous memory used by processes, typically heap, stack, and copy-on-write pages. |
Executable & libs | Executable and shared library pages that are mapped into process address space. |
File Cache | File cache that is not on the free list. |
Free, file cache | File system cache that has been placed on the free list. This file cache memory still contains valid cache but will be consumed from the free list when memory is needed. |
Free, free | Memory that is free and not associated with any files. |
Memtool provides a list showing where the pool of filesystem cache memory has been allocated, sorted by vnode. The list summarizes the size of each vnode in the file system cache and, if possible, gives the real file name. If the real file name cannot be determined, then the device and inode number are printed for that vnode.
We can display the list of vnodes in file system cache with the memps -m command. Table 7-5 describes the columns.
# memps -m
SunOS devhome 5.7 SunOS_Development sun4u 02/08/100
00:23:12
Size E/F Filename
10232k E /export/ws/local/netscape/netscape
5648k E /export/ws/dist/share/framemaker,v5.5.3/bin/sunxm.s5.sparc/maker5X.e
2944k F /home/rmc/.netscape/history.dat
2888k E /ws/on998-tools/SUNWspro/SC5.x/contrib/XEmacs20.3-b91/bin/sparc-sun-
2000k E /export/ws/dist/share/acroread,v3.01/Reader/sparcsolaris/lib/libXm.s
1648k E /usr/dt/lib/libXm.so.4
1400k E /usr/dt/lib/libXm.so.3
1392k E /usr/openwin/server/lib/libserverdps.so.5
928k E /export/ws/dist/share/acroread,v3.01/Reader/sparcsolaris/lib/libread
824k E /export/ws/dist/share/acroread,v3.01/Reader/sparcsolaris/bin/acrorea
.
.
.
The prtswap utility shows the three main states of swap and the way in which that state affects the virtual and physical swap configured.
# prtswap -l
Swap Reservations:
--------------------------------------------------------------------------
Total Virtual Swap Configured: 336MB =
RAM Swap Configured: 159MB
Physical Swap Configured: + 177MB
Total Virtual Swap Reserved Against: 289MB =
RAM Swap Reserved Against: 111MB
Physical Swap Reserved Against: + 177MB
Total Virtual Swap Unresv. & Avail. for Reservation: 47MB =
Physical Swap Unresv. & Avail. for Reservations: 0MB
RAM Swap Unresv. & Avail. for Reservations: + 47MB
Swap Allocations: (Reserved and Phys pages allocated)
--------------------------------------------------------------------------
Total Virtual Swap Configured: 336MB
Total Virtual Swap Allocated Against: 254MB
Physical Swap Utilization: (pages swapped out)
--------------------------------------------------------------------------
Physical Swap Free (should not be zero!): 42MB =
Physical Swap Configured: 177MB
Physical Swap Used (pages swapped out): - 135MB
The MemTool GUI provides an easy method for invoking most of the functionality of the MemTool command line interfaces. Invoke the GUI as the root user to see all of the process and file information.
# /opt/RMCmem/bin/memtool &
The MemTool GUI offers three basic modes: buffer cache memory, process memory, and a process/buffer cache mapping matrix.
The initial screen shows the contents of the file system cache. The file system cache display shows each entry in the UFS file system cache. Figure 7.2 shows the fields; Table 7-6 describes them.
The GUI displays only the largest 250 files. A status panel at the top of the display shows the total number of files and the number that have been displayed.
Field | Description |
---|---|
Resident | The amount of physical memory that this file has associated with it. |
Used | The amount of physical memory that this file has mapped into a process segment or SEGMAP. Generally, the difference between this and the resident figure is what is on the free list associated with this file. |
Shared | The amount of memory that this file has in memory that is shared with more than one process. |
Pageins | The amount of minor and major page-ins for this file. |
Pageouts | The amount of page-outs for this file. |
Filename | The filename if known; otherwise, the file system mount point and inode number are shown. |
The second mode of the MemTool GUI is the process memory display. Click on the Process Memory checkbox at the left of the GUI to select this mode. The process memory display shows the process table with a memory summary for each process. Each line of the process table is the same as the per-process summary from the pmap command. Figure 7.3 shows the fields; Table 7-7 describes them.
Field | Description |
---|---|
PID | Process ID of the process. |
Virtual | The virtual size of the process, including swapped-out and unallocated memory. |
Resident | The amount of physical memory that this process has, including shared binaries, libraries, etc. |
Shared | The amount of memory that this process is sharing with another process, that is, shared libraries, shared memory, etc. |
Private | The amount of resident memory this process has that is not shared with other processes. This figure is essentially Resident—Shared. |
Process | The full process name and arguments. |
To select the individual process map for a process, click on one of the process entries.
The process matrix, Figure 7.4, shows the relationship between processes and mapped files. Across the top of the display is the list of processes that we viewed in the process memory display, and down the side is a list of the files that are mapped into these processes. Each column of the matrix shows the amount of memory mapped into that process for each file, with an extra row for the private memory associated with that process.
The matrix can be used to show the total memory usage of a group of processes. By default, the summary box at the top right-hand corner shows the memory used by all of the processes displayed. We can select a group of processes with the left mouse button and then summarize by pressing the Selection button at the top-middle of the display. Selecting the All/Filt button returns the full display.
3.142.54.92