Upravit

Sdílet prostřednictvím


GCLatencyMode Enum

Definition

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

public enum class GCLatencyMode
public enum GCLatencyMode
[System.Serializable]
public enum GCLatencyMode
type GCLatencyMode = 
[<System.Serializable>]
type GCLatencyMode = 
Public Enum GCLatencyMode
Inheritance
GCLatencyMode
Attributes

Fields

Name Value Description
Batch 0

Disables 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.

Interactive 1

Enables 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.

LowLatency 2

Enables 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.

SustainedLowLatency 3

Enables 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.

NoGCRegion 4

Indicates 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 LatencyMode property. You specify the no GC region latency mode by calling the TryStartNoGCRegion method and terminate it by calling the EndNoGCRegion() method.

Remarks

You can adjust the intrusiveness of garbage collection in your application by setting the LatencyMode property to any GCLatencyMode enumeration value except GCLatencyMode.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.

The GCLatencyMode.Batch mode overrides the <gcConcurrent> runtime configuration setting. If concurrent garbage collection is enabled by the <gcConcurrent> element, switching to Batch mode prevents any further concurrent collections.

Applies to

See also