Seriously though that’s a good idea. Might be better to just disable swap. :) Well, at least until I go out and buy more RAM.
The soft way would be to set ulimit for memory to something other than unlimited. To cap the max mem limit per process
Linux overcommitting memory and especially chrome/firefox beeing big-fat-memory-hogs are the problem. In fact every application which doesn't cope malloc beeing out of memory or assuming everybody has multiple gigs of memory to spare should "reevaluate".