earlyoom is a neat linux tool that kills processes a little earlier, so your system remains responsive: https://github.com/rfjakob/earlyoom The readme is pretty educational too, and even encourages you to `tail /dev/zero` to see it in action!