27

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?

jasonwryan
  • 73,126
Mark
  • 4,244

3 Answers3

13

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

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

DopeGhoti
  • 76,081
  • 2
    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 '18 at 16:53
0

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?

Mali
  • 279