What is the Out of Memory message: sacrifice child?

52,919

Solution 1

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.
 */

Solution 2

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

Share:
52,919

Related videos on Youtube

Mark
Author by

Mark

Pronouns: whatever you think is clearest to your intended audience. License notice: In addition to any statements about licensing by employees of Stack Exchange, Inc., my code contributions on this website are available under the Creative Commons CC-0 license, and my non-code contributions are available under a plain reading of the Creative Commons CC-BY-SA license, version 4.0 or later.

Updated on September 18, 2022

Comments

  • Mark
    Mark almost 2 years

    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?

  • Mark
    Mark about 8 years
    This doesn't explain the "or sacrifice child" part of the message, though.
  • Thanatos
    Thanatos over 6 years
    But what does it mean? Is there some method by which the parent can "sacrifice" a child to save itself?
  • Seamus
    Seamus over 6 years
    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.
  • neverMind9
    neverMind9 over 5 years
    It also does that for Firefox (Web Content).