Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've had this problem come up a few times and Google isn't my friend this time. Is there a quick way to recover from a swap lock? They can sometimes last twenty or more minutes which is a long time to wait if a hard reset isn't possible.

The ideal solution that I'm looking for is a utility that would halt all execution and pop up a task manager-style interface so unnecessary, memory-consuming processes can be killed. Is there something like this, or another way to recover quickly?

share|improve this question
The term you are looking for is "thrashing" – tumbleweed Dec 24 '11 at 14:05

The easy answer is: don't have so much swap.

When you really run out of memory (as in, you've used all RAM and swap), the kernel will invoke it's out of memory killer, which (in many situations) will kill off the offending program. As long as you still have swap space, the kernel thinks everything is fine. If you can't use 4G of swap usefully, don't provide 4G of swap.

There are only two situations I can think of, where lots of swap is useful:

  • hibernation. And that's not very reliable on many machines, suspend is usually more reliable, and rebooting is usually faster.
  • Programs with big memory leaks (so you can safely swap out the leaked memory, as it's not being very useful in RAM)

More hints:

  • logging in on a VT (Alt-F1) is usually faster than trying to start gnome-terminal, when you are thrashing.
  • There's a magic SysRq keypress for invoking the OOM killer.
share|improve this answer

Your Answer


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.