Operating System - HP-UX
1847576 Members
3646 Online
110265 Solutions
New Discussion

Re: How to intrepret SIZE & RES on the TOP screen?

 
SOLVED
Go to solution
Kelvin Yu
Advisor

How to intrepret SIZE & RES on the TOP screen?

Is there any correlation between SIZE & RES on the TOP screen? Can these tell if memory is leaking?

Thanks & regards,
Kelvin
4 REPLIES 4
Pete Randall
Outstanding Contributor

Re: How to intrepret SIZE & RES on the TOP screen?

Kelvin,

From man top:

SIZE Total size of the process in kilobytes.
This includes text, data, and stack.

RES Resident size of the process in kilobytes.
The resident size information is, at best,
an approximate value.


Pete

Pete
Bill McNAMARA_1
Honored Contributor
Solution

Re: How to intrepret SIZE & RES on the TOP screen?

-- finding mem leaks from cli

You can monitor for memory leaks from the command line. Assuming your process is running in background or as a daemon, identify the PID by:

# ps -ef | grep
# # Note the PID
# #
# # in what
# # follows.

# export UNIX95=1 # Turns on XPG4
# # behavior of 'ps'
# # (needed for -o
# # option to work)

Now display physical and virtual size of the process:

# ps -p -o sz,vsz,pid,state

If there is a memory leak, the values of sz (physical pages used) and vsz (virtual pages used) will gradually increase while the code executes.
It works for me (tm)
James R. Ferguson
Acclaimed Contributor

Re: How to intrepret SIZE & RES on the TOP screen?

Hi Kelvin:

If you suspect memory leaks, one way to look for culprits is to watch for growth in the amount of memory consumed by a process:

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | awk 'NR>1' | sort -rnk2

Note the blank (space) character after the equal sign and before the 'ps' command.

Regards!

...JRF...
Bill Douglass
Esteemed Contributor

Re: How to intrepret SIZE & RES on the TOP screen?

SIZE is the total virtual memory used by the process.

RES is the amount of that process's VM actually loaded into RAM.

If a process has a memory leak, the SIZE will continually increase.

See the man page for top for more details. Also look at ps as a way to get info about a process's memory usage.

Also check out process accounting (man 1m acct)