3 ms·
There are a lot of options available, some outlined here: http://www.oracle.com/technetwork/articles/servers-storage-dev/oom-killer-1911807.html http://www.orac
by openasocket 9y ago
There are a lot of options available, some outlined here: http://www.oracle.com/technetwork/articles/servers-storage-dev/oom-killer-1911807.html http://www.oracle.com/technetwork/articles/servers-storage-d...
You can configure the OOM killer to simply panic on OOM. You can also control which processes are prioritized for OOM killing, as the sibling comment mentions.
Not mentioned in the article is that you can set per-process memory usage limits, where subsequent calls to malloc() will return NULL if trying to allocate more. Some applications will try to properly handle that condition, many will just segfault or do some kind of controlled abort. For a lot of applications failing is the right behavior on memory allocation failure. I mean, presumably you weren't trying to allocate that memory on a whim, you need that memory to function properly! So there really isn't any sane way to continue functioning without either disabling functionality or hanging until memory becomes available. Either way, I generally prefer something to unambiguously fail so I can restart it than have a "gray failure" where the system tries to keep limping along.