Topic
2 replies Latest Post - ‏2013-05-30T00:39:32Z by DanBraden
bsd2005
bsd2005
1 Post
ACCEPTED ANSWER

Pinned topic How to calculate the memory a process use? Is one of SZ/SIZE/RSS indicating it?

‏2013-05-08T07:23:26Z |

Each time we run batch job the svmon shows that there is a raise in virtual memory like this:

before:

               size       inuse        free         pin     virtual   mmode
memory      4194304     4188800        5351     1068262     5965995     Ded
pg space    5373952     3432671

               work        pers        clnt       other
pin          924646           0           0      143616
in use      4024763           0      164037

PageSize   PoolSize       inuse        pgsp         pin     virtual
s    4 KB         -     1127904      645807      195030     1489851
m   64 KB         -      191306      174179       54577      279759

after:

               size       inuse        free         pin     virtual   mmode
memory      4194304     4070601      123630     1068217     5832891     Ded
pg space    5373952     3735886

               work        pers        clnt       other
pin          924601           0           0      143616
in use      3919610           0      150991

PageSize   PoolSize       inuse        pgsp         pin     virtual
s    4 KB         -      773273      803614      195033     1309755
m   64 KB         -      206083      183267       54574      282696
 

I use ps aux and ps vg, get SIZE/SZ/RSS and is told:

SZ (l, -l) the core image size of the process, in 1kb units
SIZE (v) the virtual size of the data section of the process, in 1k
units.
RSS (v) the real memory size of the process, in 1k units

I wonder which one will indicates the memory using by a process in AIX to check if there is a memory leak. Could anybody help on this? Thank you very much!

  • This reply was deleted by Tibor_B 2013-05-11T21:57:31Z. Reason for deletion: double post
  • Tibor_B
    Tibor_B
    41 Posts
    ACCEPTED ANSWER

    Re: How to calculate the memory a process use? Is one of SZ/SIZE/RSS indicating it?

    ‏2013-05-11T21:55:39Z  in response to bsd2005

    You posted too many numbers and it is not clear what exactly is to be a problem. Even the time order is not obvious.

    Memory management on unix/linux is quite complicated, but to your question:

    RSS is quite good info to find out which processes are taking too much memory, however some processes can have part of their memory paged out.

    If you have a specific process you want to watch, try this:

    svmon -P 60227638 -O segment=category -O filterprop=data -O unit=MB | grep -p segments
    ...............................................................................
    SYSTEM segments Inuse Pin Pgsp Virtual
                           50.6     37.7    0    50.6  

    ...............................................................................
    EXCLUSIVE segments Inuse Pin Pgsp Virtual
                          12.3    0.19    0    12.3

    ...............................................................................
    SHARED segments Inuse Pin Pgsp Virtual
                       1411.62    0    0    1313.00



    I believe that memory leak would shown in "EXCLUSIVE" part....

    Updated on 2013-05-11T21:56:45Z at 2013-05-11T21:56:45Z by Tibor_B
  • DanBraden
    DanBraden
    5 Posts
    ACCEPTED ANSWER

    Re: How to calculate the memory a process use? Is one of SZ/SIZE/RSS indicating it?

    ‏2013-05-30T00:39:32Z  in response to bsd2005

    The answer to your question of how much memory a process uses, is more complicated that one would assume.   One might ask whether you mean real or virtual memory (looks like you are concerned about virtual memory of a process), whether to include memory used for shared libraries (and likely used by other processes as well), the kernel segment for the process, or application code that is stored in a file system (and might be shared/used by other processes as well), and shamat'ed or mmap'ed segments used by more than 1 process.  

    To examine memory use by a single process, use # svmon -P <PID>

     

    If you're concerned about a memory leak, I'd suggest:

    http://www.ibm.com/developerworks/aix/library/au-mallocdebug.html

    http://www-01.ibm.com/support/docview.wss?uid=isg3T1011780