I need to find out stack of main function ...
Like while we create a thread, we have stack base and stack size...
So if I assume my main is also a thread in itself, It will have some stack.
How can I find out limits of this stack?
I need to find out stack of main function ...
Like while we create a thread, we have stack base and stack size...
So if I assume my main is also a thread in itself, It will have some stack.
How can I find out limits of this stack?
I've heard 2 Mb mentioned before, but the only two ways to find out are:
1) Check the compiler doc's, or
2) Write a very simple program with just a main function, that uses up increasing amounts of stack space, until your program fails from lack thereof.
That amount may change with different systems, having different amounts of free RAM.
Although I've never done it, I think you can use getrlimit for this purpose, in Linux. In windows there will be functions for that as well, though I don't know which.