#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define MEM (1024*1024)
#define PHY 256
int main()
{
char *some_memory;
size_t size=MEM;
int i=0;
while(i<2*PHY)
{
some_memory=(char *)malloc(size);
if(some_memory!=NULL)
{
i++;
sprintf(some_memory,"hello world!");
printf("%s-now allocated %d MEM\n",some_memory,i);
}
else
{
exit(EXIT_FAILURE);
}
}
exit(EXIT_SUCCESS);
}