Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On a small VPS of mine, I have enough free memory for the things that are running there (as in the log below), but every once in a while, when I run free -m, I see all the swap is taken up.

What could it mean? Is it something I should be worried about or is it just swap that was not freed from a previous spike or something?

             total       used       free     shared    buffers     cached
Mem:           256        225         30          0          5         46
-/+ buffers/cache:        173         83
Swap:          511        511          0
share|improve this question

2 Answers 2

Your system use all swap after memory spike. Use ps(tor or htop) to find process that use a memory.

share|improve this answer

When you see the output of "free -m" as quoted above, the memory is still in use, so you are in a middle of a "memory spike". Swap space gets immediately freed after the process(es) die, that used it.

Unfortunately, it is hard to find out with "ps", which of your processes are eating the swap space. A first bet is any of the processes, that also uses a lot of non-swapped-out memory. If you can easily restart them and can live with the service being interrupted for a few seconds, just "kill" those suspects and see, whether swap use goes down.

share|improve this answer
    
The fact that there is a quantity of free and cached memory suggests that much of what is in swap is not being frequently used, vmstat would probably show a low number of swap blocks in/out. top(1) can be sorted by memory usage and will likely show who the offenders are so that they can be restarted. –  mtinberg Jun 29 '11 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.