How to check how much memory a solaris process consumes? I'd like both total address space allocated and the amount that is resident in RAM.

I tried summing pmap output with some awk script, but it was an ugly hack. Is there a better way to script it?

link|improve this question
feedback

4 Answers

prstat

Or maybe a dtrace-script?

link|improve this answer
Prstat is an obvious choice for interactive monitoring. – Tadeusz A. Kadłubowski Oct 16 '09 at 13:11
feedback
  1. prstat -s rss

    '-s' sorts prstat output by rss column (see man page for other columns). Also try '-a' option for a per user accumulation.

  2. ps -eo pid,pmem,vsz,rss,comm | sort -rnk2 | head

    Top 10 RAM consumers. '-o pmem' displays percentage of resident memory i.e. RAM used by process.

  3. ls -lh /proc/{pid}/as

    Easy way to show total address space (vsz) of a process. Useful in combination with pgrep to accumulate by user, pattern, ... e.g.:

    for pid in `pgrep -U webserver`; do ls -lh /proc/$pid/as; done
    
link|improve this answer
feedback

Well, after I've read through some man pages I got the following

ps -o vsz -p $PID | tail -1

It is quite straightforward. The format for resident size is rss.

link|improve this answer
feedback

My $.02 as the Zenoss Community Manager...

Zenoss can monitor the health of all your network devices and servers, as well as the processes running on you servers. One of our Community members recently submitted Process Monitoring for Solaris via SNMP: http://community.zenoss.org/docs/DOC-5882

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.