How To Make Kernel Kill OOM Apps

I'm Using Fedora 64bit 3GB of RAM ... so kill this one ..
#include <stdio.h>
#include <stdlib.h>
#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;
    printf("Currently allocating %d MB\n", ++count);
  }
  exit(0);
}

Comments

Popular posts from this blog

Byobu : Japanese term for decorative