I have a machine with 128M memory, and this is the program.
while(1)
{
ptr = malloc(1024 * 1024 * 100);
if (NULL == ptr)
{
printf("malloc 100M Failed\n");
return 1;
}
n+=100;
printf("malloc %dM\n", n);
}
I found from output that malloc run 20 times, why?