Prstat rss and swap

Hi,

someone please explain me what's the difference b/w rss and swap in PRSTAT.

i'm getting output like below,

NPROC USERNAME SWAP RSS MEMORY TIME CPU
70 weblogic 48G 46G 73% 449:17:03 0.4%

swap always remains 48G, but rss will change frequently,, now, there is a difference of 2GB in b/w swap and rss, that means weblogic can use another 2GB??

correct me if im wrong..

Thanks in advance.

SWAP means the total virtual memory size of the process, while rss means the portion of the vitual memory which is actually in physical memory.

See Man Page for prstat (opensolaris Section 1) - The UNIX and Linux Forums for more information

swap it the size of the process virtual memory space (includes RAM but also swap area and unused yet reserved space)
rss is the subset of the former metric currently stored in RAM.

Edit: hergp was clearly faster ...

Then RSS can utilize/extend to maximum size of memory in SWAP ... correct ??
here my scenario is, some of the processes are getting crashed when RSS size almost reaches SWAP size, then it cannot allocate new memory in it..
correct me if im wrong..

Thanks

That's right. The operating system tries to avoid this situation by paging (and swapping). But if a process protects too much of it's address space against paging, it sometimes has a really hard time to do so.

thanks a lot,
currently rss is reaching size.

PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
12503 weblogic 3048M 2968M sleep   59    0   6:32:06 0.1% java/150

so, if it RSS reaches SIZE , then OS tries to use the new memory in swap. here, can't we manually increase the size of the process. OR any parameter to limit the process size , so that we can increase it.

The RSS value is always less than or equal than the SWAP value, but both of these are dynamic.
SWAP is not a hard limit as the process is free to allocate more memory, i.e. increase its prtstat SWAP value.

Your process should be able to allocate more virtual memory unless the OS has no more virtual memory free or if the process itself has a hard limit configured (eg: java -Xmx).
Use "swap -s" to figure it out.

Hi jlliagre,

where can i configure the hard limit for a process?

thanks,

Most processes have no hard limit configured.
32-bit processes have a 4 GiB technical limit.
Java processes (JVMs) have a hard limit for their heap size set with the -Xmx option. It is normally set in the script that launch them.

Please post:

ptree pid
pargs -a pid

output after replacing pid by the process id of the java command you are investigating (was 12503).

thanks very much jlliagre and herpg. :slight_smile:

please share some commands to investigate a process, memory utilization of pid.

man pmap
man truss
man tusc
man strace

(may depend on your OS)

A good start would be to post the output of the commands I already suggested.

In addition, swap -s and swap -l when you are close to the limit might help.