1757765 Members
2381 Online
108863 Solutions
New Discussion юеВ

Re: memory for a process

 
SOLVED
Go to solution
Chris Baugh
Occasional Advisor

memory for a process

Does anyone know te easiest way of working out the amount of memory a particular process is using?
6 REPLIES 6
Pedro Cirne
Esteemed Contributor

Re: memory for a process

Hi,

You can use the "top" there you have the total size, including Virtual Memory and the Resident Size, the memory currently ocupied on phisical RAM.

Enjoy :-)
kam_6
New Member

Re: memory for a process

You can use glance and process parameter it will give all the details
Chris Baugh
Occasional Advisor

Re: memory for a process

Isn't the memory reported by top a summary, rather than for each individual process?
Gopi Sekar
Honored Contributor

Re: memory for a process


you can use top command to find out the current memory usage of the process.

you can also get these information through ps with some extra output tokens

Regards,
Gopi
Never Never Never Giveup
HGN
Honored Contributor

Re: memory for a process

Hi

Glance is a better product for this,the details are correct from the glance output.

Rgds

HGN
Geoff Wild
Honored Contributor
Solution

Re: memory for a process

Here's a script:

# cat /usr/local/bin/processmem
#!/bin/sh
# processmem - display memory claimed by a process
# gwild 03192004
#
if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "processmem \"process\""
echo "Example:"
echo "processmem rpc"
exit 1
fi
echo " "

PROCESS=$1

mps=0
#for sz in `ps -elf | grep $PROCESS | grep -v grep | awk '{print $10}'`
for sz in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -rnk1 | grep -v Kbytes | grep $PROCESS | awk '{print $1}'`
do
mps=`expr $mps + $sz`
done
#echo `expr $mps \* 4096`
echo "\nMemory claimed by $PROCESS: $mps Kbytes.\n"


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.