I did a little recursive experiment that gave me about 87,000 iterations before the stack space ended. A method call always uses the stack, not the heap. If there is a way to create a stack-based heap, then you can leave a little more. In this regard, read the following article (although it cannot be used in C #!):
recursion using only heap area
Also check this out ...
http://joel.inpointform.net/software-development/explanation-of-stack-heap-and-recursion-causing-stack-overflow/
Change Answering your question ...
Typically, the fact is that if your application tries to exceed the stack space, you will get a StackOverflowException. If your application tries to exceed a bunch of space, you will get an OutOfMemoryException
source share