Monitor session memory with onstat -g mem and onstat -g stm output

Use the onstat -g mem and onstat -g stm commands to obtain information about the memory used for each session.

You can determine which session to focus on by the used memory column of the onstat -g ses output.

onstat -g mem and onstat -g stm to determine session memory shows sample onstat -g ses output and some of the onstat -g mem and onstat -g stm output for Session 16.
  • The output of the onstat -g mem command shows the total amount of memory used by each session.

    The totalsize column of the onstat -g mem 16 output shows the total amount of memory allocated to the session.

  • The output of the onstat -g stm command shows the portion of the total memory allocated to the current prepared SQL statement.

    The heapsz column of the onstat -g stm 16 output in the following figure shows the amount of memory allocated for the current prepared SQL statement.

Figure 1: onstat -g mem and onstat -g stm to determine session memory
onstat -g ses

session                                      #RSAM    total      used      
id       user     tty      pid      hostname threads  memory     memory    
18       informix -        0        -        0        12288      8928      
17       informix 12       28826    lyceum   1        45056      33752     
16       virginia 6        28743    lyceum   1        90112      79504     
14       virginia 7        28734    lyceum   1        45056      33096     
3        informix -        0        -        0        12288      10168     
2        informix -        0        -        0        12288      8928      



onstat -g mem 16

Pool Summary:
name         class addr     totalsize freesize #allocfrag #freefrag 
16           V     a9ea020  90112     10608    159        5         
...


onstat -g stm 16

session   16 ---------------------------------------------------------------
 sdblock  heapsz  statement ('*' = Open cursor)
 aa0d018   10056 *SELECT C.customer_num, O.order_num
FROM customer C, orders O, items I
WHERE C.customer_num = O.customer_num
AND O.order_num = I.order_num