1834255 Members
2635 Online
110066 Solutions
New Discussion

Memory management

 
Joe Profaizer
Super Advisor

Memory management

What's a quick and easy way to identify memory allocated to individual processes? Or which processes are memory hogs?

Thanks!

..Joe
6 REPLIES 6
Vincenzo Restuccia
Honored Contributor

Re: Memory management

vmstat,top.
Joseph C. Denman
Honored Contributor

Re: Memory management

I would use:

top

...jcd...
If I had only read the instructions first??
A. Clay Stephenson
Acclaimed Contributor

Re: Memory management

Glance is the tool of choice but a quick and dirty way to do this (and the price is right!)
is:
ps -el | grep -v "PID" | sort -r -k10,10

This will sort the process list in reverse order of SZ.

You probably also should look at shared memory via ipcs -ma.

Clay
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Memory management

Hi Joe:

Several things come to mind:

Probably the easiest is this script from Bill Hassell:

# UNIX95= ps -e -o "user,vsz,pid,ppid,arg" | sort -rnk2 | more

'glance' and 'top' are very useful tools, too.

'ipcs' displays information in short format for the message queues, shared memory segments, and semaphores that are currently active in the system.

...JRF...
Juan González
Trusted Contributor

Re: Memory management

Hi Joe,
with glance you can select a individual process and obtain a detailed report of the diferents kinds of memory it uses (text, data, stack, shmem).
Other tool that report individual use of memory is top and "ps -l"(in physical pages) but are less detailed and even can give a wrong measure.

Best regards
Juan Gonzalez
Best regard
Mladen Despic
Honored Contributor

Re: Memory management

Joe,

If you have a recent version of Glance, try this:

glance -adviser_only -syntax /opt/perf/examples/adviser/proc_mem_leak

Mladen