System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Which process is using swap mem?

WW451512
Advisor

Which process is using swap mem?

Hi..

Is there any way to find out which process is utilizing the highest amount of swap memory (not the physical memory)?

Thanks
4 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Which process is using swap mem?

You will most likely have to write your own using pstat_getprocvm(2).

What are you really trying to determine?
WW451512
Advisor

Re: Which process is using swap mem?

Nothing specifically...just wanted to know if this can be done (without much pains).
Don Morris_1
Honored Contributor

Re: Which process is using swap mem?

It can't be done without an enhancement request to the kernel. The swap accounting is not reported broken down to whether the reservation is accounted from memory swap or not, only that it is reserved swap. There's an exception in that you can get the amount of locked memory by a process and that amount equates to a memory swap reservation, but that's all you could tell from the existing interfaces.

Can you elaborate on how you might use this information? Maybe there is another way to approach the issue.

As far as printing the top consumers of swap reservation space in general and lockable memory, sample code is attached.

Re: Which process is using swap mem?

it may help you

UNIX95= ps -ef -o comm,user,group,vsz,sz,pcpu,pid | sort +3nr