Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I actually wish I could turn swap off safely on my work computer, because I actually have enough RAM for normal situations. Swap may eventually be an old curiosity for most people, and a "niche thing" for others... When I start swapping, it's a sign some application is leaking memory and I'd rather it didn't get any and crashed instead of freezing the machine up for ages while trashing the drive.

But as it turns out OS X behaves really badly if you try to take away its swap (last time I tried, the kernel memory usage slowly increased until it consumed almost all memory; I re-enabled flash and rebooted and it got back to normal. It's a bit annoying that we've become so dependent on a kludge to work around too little memory. (Brings me back to my Amiga days and the long, heated discussions about whether or not swap was a good idea in the first place)



One trick people in a similar situation on linux use is to make a small ram disk and then assign that as the swap. A little absurd but prevents the bad behavior.


It is indeed absurd, when swapping can be avoided entirely by setting kernel swappiness to 0:

sysctl -w vm.swappiness=0

to make permanent, set vm.swappiness=0 in /etc/sysctl.conf

Though for a desktop machine, disabling swap probably won't help improve performance


That's true, but this was a special circumstance where disabling swap was creating very bad system behavior.


pre 3.5 it doesn't actually disable swap, it will only use it when it's about to OOM.

post 3.5 it does actually hard-disable, but setting swappiness to 1 gives the same behaviour as swappiness=0 in < 3.5


That's good to know, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: