I wrote this program to understand memory consumption pattern.
#include <stdio.h>
#include <stdlib.h>
int main()
{
   int i=0;
   while(1 < 2) {
   int *str = (int *) malloc(100000000);
   if(str == NULL) {
      printf("Out of memory.. %d", i);
      return(1);
   }
   printf("Attempt Count = %d\n", i++);
   }
   return(0);
}
In my system, I have 8 GB ram. Each malloc call will attempt to store 100MB. So I was expecting that my program would crash in (10* 8) loops. But the counter is going well beyond 600,000. I am not able to reason out the same. Kindly help.
Even considering all swap spaces and all, it should not increase more than 16GB, which does not look likely here.
 
     
     
    