title: Linux OOM killer does not work
body: <p>I would like to test if the kernel OOM killer work fine on my embedded Linux or not. I used an application test to fill all memory and see if OOM will kill my application if the system run in out of memory condition.</p>
  
  <p>The test program I used:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define MEGABYTE 1024*1024
  
  int main(int argc, char *argv[])
  {
          void *myblock = NULL;
          int count = 0;
  
          while(1)
          {
                  myblock = (void *) malloc(MEGABYTE);
                  if (!myblock) break;
                  memset(myblock,1, MEGABYTE);
                  printf("Currently allocating %d MB\n",++count);
  
          }
          exit(0);
  
  }
  </code></pre>
  
  <p>Results:</p>
  
  <p>I always get :</p>
  
  <pre><code>MyApplication triggered out of memory codition (oom killer not called): gfp_mask=0x1200d2, order=0, oomkilladj=0
  </code></pre>
  
  <p>I try to change /etc/sysctl by adding :</p>
  
  <pre><code>vm.oom_kill_allocating_task=1
  vm.panic_on_oom=0
  vm.overcommit_memory=0
  how can I make OOM works fine on my system 
  </code></pre>
  
  <p>Kernel version :2.6.30 #7 SMP PREEMPT</p>