My computer recently ran out of memory (a not-unexpected consequence of compiling software while working with large GIS datasets). In the system log detailing how it dealt with the OOM condition is the following line:

Out of memory: Kill process 7429 (java) score 259 or sacrifice child

What is that or sacrifice child about? Surely it isn't pondering some dark ritual to keep things going?

up vote 1 down vote accepted

From source files I found oom_kill.c, the OOM Killer, after such message is written in system log, checks children of the process identified and evaluates if possible to kill one of them in place of the process itself.

Here a comment extracted from source file explaining this:

/*
 * If any of p's children has a different mm and is eligible for kill,
 * the one with the highest oom_badness() score is sacrificed for its
 * parent.  This attempts to lose the minimal amount of work done while
 * still freeing memory.
 */

It's talking about killing a child process of the process nominated to be sent a KILL signal.

  • But what does it mean? Is there some method by which the parent can "sacrifice" a child to save itself? – Thanatos Dec 11 '17 at 19:46
  • My guess, which is just a guess, is that since all process are descendants of the Linux init process that the parent in this context is a Linux process where the children are the various applications. In this case, the Linux process is saving itself by killing one of its children. – Seamus Mar 16 at 16:53

This is Oom(Out of memory) killer. When your system runs out of memory, the linux kernel kills processes to free memory. An heuristic determines which process is the best candidate to get memory freed without damaging the system (typically, root owned processes are not best candidates).

More details here : How OOM killer decides which process to kill first?

  • 4
    This doesn't explain the "or sacrifice child" part of the message, though. – Mark May 10 '16 at 20:41

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.