I'm running heavily leaking apps on server which have already swapped out about 60gb of garbage in their over 100 days uptime. At the point when I've run out of swap for the first time (32gb) I started to plug in pendrives and swapon them. It helped for about month but I'm slowly running out of pendrives and USB ports... I came to conclusion that probably all of important stuff has been swapped off to first swap (i think) and stuff left in swap spaces with lower priorities are probably just leaks so... What if I'd just unplug those pendrives, format them and swapon again? Is it more likely to crash those apps or whole OS?

  • 2
    That's a good question, but I have to note that using flash drives as swap space is a terrible idea. They are slow, they wear out and they don't solve the actual problem of leaking RAM. – gronostaj Apr 23 '16 at 22:01
  • @user21111737 Try it and report back how it goes. – Moab Apr 24 '16 at 16:09
  • @Moab when I started to use server today it turned out to be so extremely sluggish because of constant swap operations that it was almost unusable anyways. Sometimes I was encountering ssh login timeouts because of i/o delay. I decided to kill all processes with excessive swap utilization. But I'll check it on laptop in a while. – Lapsio Apr 24 '16 at 22:50

You should not get a system crash unless you manage to trigger a kernel bug by this. There may be some lurking, as unplugging active swap devices is most likely not a common test scenario.

If your system doesn't crash, your applications will die one by one as soon as they try to access any of the swapped out pages that are no longer available.

It's by far safer to kill and restart the leaking apps, all the leaked memory will be freed when they exit.


So I tested it. After unplugging pendrive system encounters immediete panic. Even there was actually some spare RAM so swap wasn't actively accessed at the time of device unplug, still it caused system crash.

Nothing has been recorded by system journal, just like in case of filesystem crash. It might be eventually caused by btrfs I use because systems using btrfs also encounter panic when they run out of RAM (and swap) (oom killer is not activated, just system crashes with the same result - no journal records)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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