GC::TryStartNoGCRegion Method
Attempts to disallow garbage collection during the execution of a critical path.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | TryStartNoGCRegion(Int64) | Attempts to disallow garbage collection during the execution of a critical path if a specified amount of memory is available. |
![]() ![]() | TryStartNoGCRegion(Int64, Boolean) | Attempts to disallow garbage collection during the execution of a critical path if a specified amount of memory is available, and controls whether the garbage collector does a full blocking garbage collection if not enough memory is initially available. |
![]() ![]() | TryStartNoGCRegion(Int64, Int64) | Attempts to disallow garbage collection during the execution of a critical path if a specified amount of memory is available for the large object heap and the small object heap. |
![]() ![]() | TryStartNoGCRegion(Int64, Int64, Boolean) | Attempts to disallow garbage collection during the execution of a critical path if a specified amount of memory is available for the large object heap and the small object heap, and controls whether the garbage collector does a full blocking garbage collection if not enough memory is initially available. |
Important |
|---|
You cannot nest calls to the TryStartNoGCRegion method, and you should only call the EndNoGCRegion method if the runtime is currently in no GC region latency mode. In other words, you should not call TryStartNoGCRegion multiple times (after the first method call, subsequent calls will not succeed), and you should not expect calls to EndNoGCRegion to succeed just because the first call to TryStartNoGCRegion succeeded. |


