Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GCLatencyMode Enumeration

Adjusts the time that the garbage collector intrudes in your application.

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

public enum GCLatencyMode

Member nameDescription
Supported by Portable Class LibraryBatchDisables garbage collection concurrency and reclaims objects in a batch call. This is the most intrusive mode.

This mode is designed for maximum throughput at the expense of responsiveness. 

This mode overrides the <gcConcurrent> runtime configuration setting. If <gcConcurrent> is enabled, switching to Batch mode prevents any further concurrent collections.

Supported by Portable Class LibraryInteractiveEnables garbage collection concurrency and reclaims objects while the application is running. This is the default mode for garbage collection on a workstation and is less intrusive than Batch. It balances responsiveness with throughput.

This mode is equivalent to garbage collection on a workstation that is concurrent.

Supported by Portable Class LibraryLowLatencyEnables garbage collection that is more conservative in reclaiming objects. Full collections occur only if the system is under memory pressure, whereas generation 0 and generation 1 collections might occur more frequently

This mode is not available for the server garbage collector.

NoGCRegionIndicates that garbage collection is suspended while the app is executing a critical path. NoGCRegion is a read-only value; that is, you cannot assign the NoGCRegion value to the GCSettings.LatencyMode property. You specify the no GC region latency mode by calling the TryStartNoGCRegion method and terminate it by calling the EndNoGCRegion method.
SustainedLowLatencyEnables garbage collection that tries to minimize latency over an extended period. The collector tries to perform only generation 0, generation 1, and concurrent generation 2 collections. Full blocking collections may still occur if the system is under memory pressure.

You can adjust the intrusiveness of garbage collection in your application by setting the LatencyMode property to any GCLatencyMode enumeration value except NoGCRegion. You can also determine the garbage collector's current latency mode by retrieving the GCSettings.LatencyMode property value.

See Latency Modes for a discussion of how the runtime configuration settings for garbage collection affect the default value for this enumeration.

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
© 2015 Microsoft