Monitoring the native heap

You can monitor the memory usage of a process by taking a series of snapshots over regular time intervals of the memory currently allocated and committed.

Use svmon like this:
  svmon -P [pid] -m -r -i [interval] > output.filename

Use the -r flag to print the address range.

Because the Java™ heap is allocated using mmap() or shmat(), it is clear whether memory allocated to a specific segment of memory (under 'Esid') is allocated to the Java or the native heap. The type and description fields for each of the segments allows the determination of which sections are native or Java heap. Segments allocated using mmap or shmat are listed as "mmap mapped to" or "extended shm segments" and are the Java heap. Segments allocated using malloc will be marked as "working storage" and are in the native heap. This demarcation makes it possible to monitor the growth of the native heap separately from the Java heap (which should be monitored using verbose GC).

Here is the svmon output from the command that is shown above:
-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd LPage
   29670 java             87347     4782     5181    95830      N     Y     N

    Vsid      Esid Type Description              LPage  Inuse   Pin Pgsp Virtual
    50e9         - work                              -  41382     0    0 41382 
                   Addr Range: 0..41381
    9dfb         - work                              -  28170     0 2550 30720 
                   Addr Range: 0..30719
    ddf3         3 work working storage              -   9165     0  979 10140 
                   Addr Range: 0..16944
       0         0 work kernel seg                   -   5118  4766 1322  6420 
                   Addr Range: 0..11167
    c819         d work text or shared-lib code seg  -   2038     0  283  6813 
                   Addr Range: 0..10219
    2ded         f work working storage              -    191     0   20   224 
                   Addr Range: 0..4150
    f5f6         - work                              -     41    14    4    45 
                   Addr Range: 0..49377
    6e05         2 work process private              -     35     2   23    58 
                   Addr Range: 65296..65535
    1140         6 work other segments               -     26     0    0    26 
                   Addr Range: 0..32780
    cdf1         - work                              -      2     0    0     2 
                   Addr Range: 0..5277
    e93f         - work                              -      0     0    0     0 
    3164         c mmap mapped to sid 1941           -      0     0    -     - 
    2166         - work                              -      0     0    0     0 
    496b         b mmap mapped to sid 2166           -      0     0    -     - 
    b51e         - clnt /dev/fslv00:44722            -      0     0    -     - 
                   Addr Range: 0..207
    ee1c         a mmap mapped to sid e93f           -      0     0    -     - 
    1941         - work                              -      0     0    0     0 
    1081         7 mmap mapped to sid 9dfb           -      0     0    -     - 
    edf5         8 mmap mapped to sid 50e9           -      0     0    -     - 
    c01b         9 mmap mapped to sid cdf1           -      0     0    -     - 
The actual memory values for the mmap allocated segments are stored against a Vsid of type "work". For example, the memory usage in segment 7 (Java heap):
1081         7 mmap mapped to sid 9dfb           -      0     0    -     - 
is described against Vsid 9dfb, which reads as follows:
 9dfb         - work           -  28170     0 2550 30720   Addr Range: 0..30719


© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)