Export (0) Print
Expand All

RuntimeHelpers.ProbeForSufficientStack Method

Probes for a certain amount of stack space to ensure that a stack overflow cannot happen within a subsequent block of code (assuming that your code uses only a finite and moderate amount of stack space). We recommend that you use a constrained execution region (CER) instead of this method.

Namespace:  System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

public static void ProbeForSufficientStack()

This method is used by the constrained execution region (CER) infrastructure when running in hosts that are resilient to stack overflow such as Microsoft SQL Server and Microsoft Exchange Server. This method currently probes for 48 KB of stack space on the x86 platform, but the exact amount may change over time and may vary on other platforms.

This method is also used by compilers.

Instead of using the ProbeForSufficientStack method, you should use a standard CER. That is, if you are planning to use a moderate amount of stack space, call the RuntimeHelpers.PrepareConstrainedRegions method immediately before your try/finally or try/catch block. If you are calling a recursive method or plan to use a lot of stack space, you must use the RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup method.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • SecurityCriticalAttribute 

    requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Show:
© 2015 Microsoft