I have a ram of 8GB and I have Hard disk of 80GB. I have three programs as shown in below.
1)
main()
{
while(1)
x();
}
x()
{
printf("hello\n");
}
Will there be a memory leak here in the above program? I suppose not. In case if it does not happen then what will happen? When will this stop?
2)
main()
{
int *x;
while(1)
x=malloc(100*size(int));//there is a memory leak here
}
It's obvious that this program will crash after some time but I want to know WHEN, looking at the resources I mentioned above.
3)
main()
{
x();
}
x()
{
x();
}
Is this above program in infinite recursion? What will happen in the end? When will this program crashes/dies considering the resources I have?