GCLatencyMode GCLatencyMode GCLatencyMode GCLatencyMode Enum

定义

调整垃圾收集器侵入应用程序的时间。Adjusts the time that the garbage collector intrudes in your application.

public enum class GCLatencyMode
[System.Serializable]
public enum GCLatencyMode
type GCLatencyMode = 
Public Enum GCLatencyMode
继承
GCLatencyModeGCLatencyModeGCLatencyModeGCLatencyMode
属性

字段

Batch Batch Batch 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 Interactive Interactive Interactive 1

在应用程序运行时启用垃圾回收并发,并回收对象。Enables garbage collection concurrency and reclaims objects while the application is running. 这是工作站上垃圾回收的默认模式,并且较少受侵入 BatchThis 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 LowLatency LowLatency LowLatency 2

启用回收对象时比较保守的垃圾回收。Enables garbage collection that is more conservative in reclaiming objects. 仅在系统遇到内存压力时才发生完全回收,而通常情况下发生 0 代和 1 代回收。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.

NoGCRegion NoGCRegion NoGCRegion NoGCRegion 4

指示当应用正在执行关键路径时挂起垃圾回收。Indicates that garbage collection is suspended while the app is executing a critical path.

NoGCRegion 是一个只读值;也就是说,不能将 NoGCRegion 值分配给 LatencyMode 属性。NoGCRegion is a read-only value; that is, you cannot assign the NoGCRegion value to the LatencyMode property. 通过调用 TryStartNoGCRegion 方法指定无 GC 区域延迟模式,并通过调用 EndNoGCRegion() 方法终止该模式。You specify the no GC region latency mode by calling the TryStartNoGCRegion method and terminate it by calling the EndNoGCRegion() method.

SustainedLowLatency SustainedLowLatency SustainedLowLatency SustainedLowLatency 3

启用尝试减少延长时期的延迟的垃圾回收。Enables garbage collection that tries to minimize latency over an extended period. 回收器尝试只执行生成 0、生成 1,以及并发只生成 2 个集合。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.

注解

可以通过设置应用程序中调整侵入性的垃圾回收LatencyMode属性设置为任何GCLatencyMode以外的枚举值GCLatencyMode.NoGCRegionYou can adjust the intrusiveness of garbage collection in your application by setting the LatencyMode property to any GCLatencyMode enumeration value except GCLatencyMode.NoGCRegion. 您还可以通过检索确定垃圾回收器的当前滞后时间模式GCSettings.LatencyMode属性值。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.

GCLatencyMode.Batch模式下重写 <gcConcurrent >运行时配置设置。The GCLatencyMode.Batch mode overrides the <gcConcurrent> runtime configuration setting. 如果通过启用并发垃圾回收 <gcConcurrent >元素中,切换到批处理模式可以防止任何进一步的并发集合。If concurrent garbage collection is enabled by the <gcConcurrent> element, switching to Batch mode prevents any further concurrent collections.

适用于

另请参阅