Linux OOM Killer

The cluster focuses on Linux's memory overcommitment policy and the OOM (Out-Of-Memory) killer, debating its reliability, alternatives like disabling overcommit or using vm.panic_on_oom, and how applications handle sudden process terminations versus allocation failures.

➡️ Stable 0.6x DevOps & Infrastructure
2,411
Comments
19
Years Active
5
Top Authors
#7348
Topic ID

Activity Over Time

2008
1
2009
10
2010
26
2011
44
2012
48
2013
82
2014
79
2015
78
2016
145
2017
124
2018
159
2019
284
2020
119
2021
329
2022
271
2023
197
2024
124
2025
245
2026
46

Keywords

RAM e.g CPU cgroup.git DaVinci NULL GB IMO OOM linuxatemyram.com memory killer process malloc linux ram vm program kernel programs

Sample Comments

mshook Jul 3, 2019 View on HN

That's pretty much why we use vm.panic_on_oom = 1 as you have no idea about what's going to be killed...

BrainInAJar Aug 30, 2013 View on HN

Yes, but that's more like fork or malloc failing in the first place than letting you run and then randomly killing something when the system gets overcomitted

maxlybbert Mar 31, 2018 View on HN

You can turn off overcommit.The basic idea isn’t that having malloc return NULL on failure is worse than killing a random process when any process runs out of memory. The idea is that programs often ask for memory that they don’t need, or don’t need right away.When a program actually uses too much memory, there isn’t a way to signal failure, so the OOM gets involved. If this is wrong, turn off overcommit. Unfortunately, overcommit is a system-wide setting, so individual programs can’t opt

genter May 11, 2025 View on HN

Until the kernel kills you for being OOM.

whyever Aug 31, 2016 View on HN

How can you handle OOM if your process gets killed by the kernel for using to much memory?

AnIdiotOnTheNet Sep 20, 2018 View on HN

Same thing as everyone else: play russian roulette with the OOM-killer and hope that whatever was important to the user didn't get destroyed. Can't really do anything about the OS lying to you.

dragontamer Dec 23, 2020 View on HN

The original poster is almost certainly talking about Linux's overcommit policy: http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommi...You can't adopt a defensive / offensive stance with regards to out-of-memory issues, because on Linux... malloc doesn't fail when you run out of physical memory.Your "error"

chomp Nov 1, 2022 View on HN

If you OOM, it's gonna crash.

mbiondi Nov 22, 2022 View on HN

But then we end up with the OOM Killer, which is awful - randomly kill the biggest process because "reasons".... It would be better if the OS could say no.

Linux supports overcommitted memory and so will lie to your application about memory availability. When I tested several common open-source applications in a memory-constrained environment none of them, except for the Java VM, handled OOM conditions gracefully. I came to the conclusion it's not worth the programming effort unless your application will specifically expect this condition to occur.