InsufficientExecutionStackException
Has anyone开发者_如何学JAVA ever encountered the InsufficientExecutionStackException
? MSDN doesn't tell much about it.
What is the difference between the InsufficientExecutionStackException
and the StackOverflowException
?
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.
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
精彩评论