System swapping ... how do I figure out what the problem is
772
I have an ubuntu vps running that has about 300MB of memory, of which only 20% or less is free right now ...
My question is, how can I figure out what particular program I'm running that is causing it to swap so much?
To find out the amount of swap space used by every process, run top (not htop), press 'f' to select columns (f for fields) to display, press 'p' to add swap to display, press 'o' to sort the table (o for order by) and press 'p' again to order by swap usage.
To find out the amount of swap space used by every process, run
top
(nothtop
), press 'f' to select columns (f for fields) to display, press 'p' to add swap to display, press 'o' to sort the table (o for order by) and press 'p' again to order by swap usage.start with running
and pressing M [ shift+m ].
you will get process list sorted by mem consumption.
smem is a bit harder to use than top, but offers good information. You could start with with
sudo smem -s uss -r -k
which will output:You might also want to check out this lwn.net article, which explains the difference between RSS, PSS and USS.
Another option is
htop
, which has better output in some cases.