Operating System - HP-UX
1825748 Members
2442 Online
109687 Solutions
New Discussion

what process is hogging memory?

 
Scott_20
Occasional Advisor

what process is hogging memory?

all, if memory is maxxed out, how do you find
out which process is using it all. the 'top' version i use on gives cpu and total memory used.
thanks
scott
I'm ok
5 REPLIES 5
Rodney Hills
Honored Contributor

Re: what process is hogging memory?

Memory may show at near 100%, but that is because hpux will use available memory for I/O buffers.

A better indicator of insufficient memory is the amount of paging in/out or swapping that is going on.

HTH

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: what process is hogging memory?

First of all, memory usage in top doesn't mean what ytou think it means -- if you think that it indicates how much physical memory is in use. Top only knows about memory in use by processes; it knows nothing about kernel data structure like buffer cache. Use Glance, swapinfo, or vmstat (the pageout rate) to determine if you are under any memory pressure.

To answer you specific question about top memory use by processes:

UNIX95= ps -e -o vsz,pid,comm | sort -rn

This will sort in reverse order of vsz (size of the process in KB).
If it ain't broke, I can fix that.
Geoff Wild
Honored Contributor

Re: what process is hogging memory?

And yet another way like Clay's:

# cat memtop
#!/bin/sh
# memtop - show top memory users and pid
# VSZ is in KB

echo "VSZ(KB) PID RUSER COMMAND"
UNIX95= ps -e -o 'vsz pid ruser args' |sort -nr|head -30

Also, glance and perfview will help a lot.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Stuart Abramson
Trusted Contributor

Re: what process is hogging memory?

ps -elf shows memory for process.

man ps will show you which field it is.
Chris Vail
Honored Contributor

Re: what process is hogging memory?

To see system impact on a per process basis, use:
ps -ef|sort -k 4nr, 4|pg

This checks the process table, then sorts the data with the 4th column (CPU) and runs it through the paginator. One of the nice things about this is that the same command works on most versions of Unix, not just HP. The process(es) with the biggest impact will be at the top of the result.

Its a good way to find runaway and hung processes.

Chris