Sur certains serveurs, j'ai énormément de processus tués :

cat /var/log/syslog |grep "OOM killed"
Oct 27 13:31:37 cli2 kernel: [33918.292623] OOM killed process apache2 (pid=25927, ve=162) exited, free=8895850 gen=165.
Oct 27 13:31:37 cli2 kernel: [33918.299598] OOM killed process apache2 (pid=29878, ve=162) exited, free=8900690 gen=166.
Oct 27 13:31:37 cli2 kernel: [33918.303564] OOM killed process apache2 (pid=1310, ve=162) exited, free=8905696 gen=167.
Oct 27 13:31:37 cli2 kernel: [33918.305936] OOM killed process apache2 (pid=7352, ve=134) exited, free=8906995 gen=168.
Oct 27 13:31:47 cli2 kernel: [33928.420456] OOM killed process apache2 (pid=12134, ve=134) exited, free=8912178 gen=169

Pourtant, j'ai encore plein de mémoire disponible :

free -m
                total       used       free     shared    buffers     cached
Mem:         64406      31985      32421          0       2939      14485

Une solution éventuelle est de modifier le comportement de la gestion du OOM Killer :

echo 1 >  /proc/sys/vm/oom_kill_allocating_task
echo 2 > /proc/sys/vm/overcommit_memory

Pour un effet permanent, rajouter dans le fichier `/etc/sysctl.conf` :

vm.oom_kill_allocating_task = 1
vm.overcommit_memory = 2
sysctl -p

Un peu d'explication sur ces paramètres potentiellement dangereux :

man proc

 /proc/sys/vm/oom_kill_allocating_task (since Linux 2.6.24)
              This enables or disables killing the OOM-triggering task in out-of-memory situations.

              If  this  is  set to zero, the OOM-killer will scan through the entire tasklist and select a task based on heuristics to kill.  This
              normally selects a rogue memory-hogging task that frees up a large amount of memory when killed.

              If this is set to nonzero, the OOM-killer simply kills the task that triggered the out-of-memory condition.  This avoids a  possibly
              expensive tasklist scan.

              If /proc/sys/vm/panic_on_oom is nonzero, it takes precedence over whatever value is used in /proc/sys/vm/oom_kill_allocating_task.
              
              The default value is 0.

/proc/sys/vm/overcommit_memory
              This file contains the kernel virtual memory accounting mode.  Values are:
              
                     0: heuristic overcommit (this is the default)
                     1: always overcommit, never check
                     2: always check, never overcommit

              In mode 0, calls of mmap(2) with MAP_NORESERVE are not checked, and the default check is very weak, leading to the risk of getting a
              process "OOM-killed".  Under Linux 2.4 any nonzero value implies mode 1.  In mode 2 (available since Linux 2.6), the  total  virtual
              address  space  on  the  system is limited to (SS + RAM*(r/100)), where SS is the size of the swap space, and RAM is the size of the
              physical memory, and r is the contents of the file /proc/sys/vm/overcommit_ratio.