Export (0) Print
Expand All

RuntimeHelpers.ProbeForSufficientStack Method

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 & Microsoft Exchange. It probes for a certain amount of stack space, for the purpose of ensuring that a stack overflow cannot happen within a following block of code (assuming that your code itself only uses a finite and moderate amount of stack space). This method currently probes for 48K of stack space on x86, but the exact amount may change over time & vary on other platforms. This method is not recommended. Instead, you should use a normal CER (ie, a try/finally or try/catch block proceeded with a call to PrepareConstrainedRegions), if you're going to use a moderate amount of stack space. If you are calling a recursive method or will use a lot of stack space, then you must use ExecuteCodeWithGuaranteedCleanup.

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

public static void ProbeForSufficientStack ()
public static void ProbeForSufficientStack ()
public static function ProbeForSufficientStack ()
Not applicable.

The ProbeForSufficientStack method is a marker placed immediately before a try clause to mark the corresponding catch and finally blocks as constrained.

The classes in System.Runtime.CompilerServices are for compiler writers' use only.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2014 Microsoft