Completely disable oom killer

out of memory

I'm having some intermittent issues that appear to be related to the oomkiller purging some child processes, but I can't see why.

Is there a convenient way that I can suppress all oomkiller activity through sysctl?

I've found some instructions that say these should work, but they do not exist for me.

sysctl -w memory.oom_control=1
sysctl -w vm.oom-kill=0

I have also seen these two being suggested, but the oom killer carries right on.

sysctl vm.overcommit_memory=2
sysctl vm.overcommit_kbytes=0

Best Answer

You could use /proc/sys/vm/overcommit_memory (see proc(5)), e.g.

echo 2 > /proc/sys/vm/overcommit_memory

as root to disable it. See also the kernel's Documentation/vm/overcommit-accounting

(If you are running an old kernel, consider upgrading it)