GCConserveMemory 元素
配置垃圾回收器来节省内存,但代价是垃圾回收更频繁,并且暂停时间可能更长。 默认值为 0 - 这意味着没有更改。 除了默认值 0 以外,介于 1 至 9(含)的值都有效。 值越高,垃圾回收器越会试图节省内存,进而使堆保持较小。 如果值不为零,则将在大型对象堆具有太多碎片时自动压缩该堆。
<configuration>
<runtime>
<GCConserveMemory>
语法
<GCConserveMemory
enabled="n"/>
特性
属性 | 描述 |
---|---|
enabled |
必需的特性。 指定垃圾回收器应尝试节省内存的硬性。 |
enabled 特性
值 | 说明 |
---|---|
n |
默认值为 0 - 这意味着没有更改。 除了 0 以外,介于 1 至 9(含)的值都有效。 值越高,垃圾回收器越会试图节省内存,进而使堆保持较小。 |
子元素
无。
父元素
元素 | 说明 |
---|---|
configuration |
公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。 |
runtime |
包含有关程序集绑定和垃圾回收的信息。 |
备注
此设置是在 .NET Framework 4.8 中引入的。
请参阅
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
The .NET documentation is open source. Provide feedback here.
反馈
提交和查看相关反馈