I am able to compile a program with 1 GiB RAM on a VPS using old 2.6.x kernel. But when I tried to compile it on a VPS with 1.1 GiB RAM and 3.9.x kernel, the compiler always killed by OOM Killer.
How do I make OOM more passive?
I am able to compile a program with 1 GiB RAM on a VPS using old 2.6.x kernel. But when I tried to compile it on a VPS with 1.1 GiB RAM and 3.9.x kernel, the compiler always killed by OOM Killer.
How do I make OOM more passive?
You don't change the OOM killer - it's like that for a reason. but what you should do is reduce the memory overcommit. By default this is 50% (see /proc/sys/vm/overcommit_ratio) to handle the case where programs try to claim more memory than they ever need. But if you've got well-written programs which only claim the amount of memory they need (or you're runing JVMs which never do gc because they don't know the system is tight on memory) then the OOM Killer starts harvesting stuff.
If you have enough space on your FS you can add temporary swap space to your VM via:
# fallocate -l 4g /SWAP
# mkswap /SWAP
# swapon /SWAP
But keep in mind that compilation won't be a fast process if your system is aggressively swapping.