Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InsufficientExecutionStackException

Has anyone ever encountered the InsufficientExecutionStackException? MSDN doesn't tell much about it.

What is the difference between the InsufficientExecutionStackException and the StackOverflowException?

like image 284
Michael Damatov Avatar asked Mar 30 '11 20:03

Michael Damatov


2 Answers

This exception is thrown by RuntimeHelpers.EnsureSufficientExecutionStack. See https://msdn.microsoft.com/library/system.runtime.compilerservices.runtimehelpers.ensuresufficientexecutionstack.aspx

In contrast to a StackOverflowException you can catch a InsufficientExecutionStackException and handle the situation gracefully.

like image 144
Florian Greinacher Avatar answered Nov 13 '22 03:11

Florian Greinacher


From CLR Via C#

Just before invoking a method, you could check for ample stack space by calling the RuntimeHelper class’s EnsureSufficientExecutionStack method This method checks if the calling thread has enough stack space available to execute the average
method (which is not well defned) If there is insuffcient stack space, the method throws an InsufficientExecutionStackException which you can catch The EnsureSufficientExecutionStack method takes no arguments and returns void This method is typically used by recursive methods

like image 30
Diadistis Avatar answered Nov 13 '22 04:11

Diadistis