Linux/OOM

Swappiness
Set Swappiness Level: sudo sysctl -w vm.swappiness=0    # The kernel will swap only to avoid an out of memory condition sudo sysctl -w vm.swappiness=60   # The default value. sudo sysctl -w vm.swappiness=100  # The kernel will swap aggressively.

See: https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps

Mem Eater
int main { for {char* mem=malloc(4096); mem[0]=1;}; }
 * 1) include 

gcc memeater.c -o memeater ./memeater

much slower: int main { int i;   for  {char* mem=malloc(256); mem[0]=1;for(i=1;i<=100000;i++){;;}}; }
 * 1) include 

Source: http://unix.stackexchange.com/questions/135114/out-of-swap-what-happens