It seems to be that in OS X, whenever you are out of ram the system happily swaps to disk. This easily becomes an disaster due to the fact that the swapped out memory eventually fills my drive. On my Macbook Air with 2GB ram and 64GB disk this is a major problem.
In order to solve this I've created a crontab running a purge-command every 10:th minute. It minimizes the swap from growing and also makes the system more responsive whenever the system is swapping. I've tried to disable swap but it's far to unreliable.
Can you configure this behavior? Is there a better solution?
$crontab -e
*/10 * * * * purge
sysdiagnose
at boot and then again after launching your usual apps and finally when you notice that swap is running away. I have Macs that run for months at a time and never have swap pressure like you show here. The system only swaps when a program asks for memory, leaks it and never frees it. You've probably got several leaks - the severity of which would be measured by how short the timeperiod needed to accumulate each gig of swap to disk. – bmike Sep 19 '12 at 13:14hibernatefile
(8.59 GB) plus swap files. In most cases I treatpurge
as a last resort because of the resulting increase in disk activity. – Graham Perrin Feb 02 '13 at 14:29