Hendelser
17. mars, 21 - 21. mars, 10
Bli med i meetup-serien for å bygge skalerbare AI-løsninger basert på virkelige brukstilfeller med andre utviklere og eksperter.
Registrer deg nåDenne nettleseren støttes ikke lenger.
Oppgrader til Microsoft Edge for å dra nytte av de nyeste funksjonene, sikkerhetsoppdateringene og den nyeste tekniske støtten.
This page contains information about settings for the .NET runtime garbage collector (GC). If you're trying to achieve peak performance of a running app, consider using these settings. However, the defaults provide optimum performance for most applications in typical situations.
Settings are arranged into groups on this page. The settings within each group are commonly used in conjunction with each other to achieve a specific result.
Obs!
DOTNET_
instead of COMPlus_
. However, the COMPlus_
prefix will continue to work. If you're using a previous version of the .NET runtime, you should still use the COMPlus_
prefix, for example, COMPlus_gcServer
.For different versions of the .NET runtime, there are different ways to specify the configuration values. The following table shows a summary.
Config location | .NET versions this location applies to | Formats | How it's interpreted |
---|---|---|---|
runtimeconfig.json file/ runtimeconfig.template.json file |
.NET (Core) | n | n is interpreted as a decimal value. |
Environment variable | .NET Framework, .NET (Core) | 0xn or n | n is interpreted as a hex value in either format |
app.config file | .NET Framework | 0xn | n is interpreted as a hex value1 |
1 You can specify a value without the 0x
prefix for an app.config file setting, but it's not recommended. On .NET Framework 4.8+, due to a bug, a value specified without the 0x
prefix is interpreted as hexadecimal, but on previous versions of .NET Framework, it's interpreted as decimal. To avoid having to change your config, use the 0x
prefix when specifying a value in your app.config file.
For example, to specify 12 heaps for GCHeapCount
for a .NET Framework app named A.exe, add the following XML to the A.exe.config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
...
<runtime>
<gcServer enabled="true"/>
<GCHeapCount>0xc</GCHeapCount>
</runtime>
</configuration>
For both .NET (Core) and .NET Framework, you can use environment variables.
On Windows using .NET 6 or a later version:
SET DOTNET_gcServer=1
SET DOTNET_GCHeapCount=c
On Windows using .NET 5 or earlier:
SET COMPlus_gcServer=1
SET COMPlus_GCHeapCount=c
On other operating systems:
For .NET 6 or later versions:
export DOTNET_gcServer=1
export DOTNET_GCHeapCount=c
For .NET 5 and earlier versions:
export COMPlus_gcServer=1
export COMPlus_GCHeapCount=c
If you're not using .NET Framework, you can also set the value in the runtimeconfig.json or runtimeconfig.template.json file.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true,
"System.GC.HeapCount": 12
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.Server": true,
"System.GC.HeapCount": 12
}
}
The two main flavors of garbage collection are workstation GC and server GC. For more information about differences between the two, see Workstation and server garbage collection.
The subflavors of garbage collection are background and non-concurrent.
Use the following settings to select flavors of garbage collection:
false
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.Server |
false - workstationtrue - server |
.NET Core 1.0 |
MSBuild property | ServerGarbageCollection |
false - workstationtrue - server |
.NET Core 1.0 |
Environment variable | COMPlus_gcServer |
0 - workstation1 - server |
.NET Core 1.0 |
Environment variable | DOTNET_gcServer |
0 - workstation1 - server |
.NET 6 |
app.config for .NET Framework | GCServer | false - workstationtrue - server |
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.Server": true
}
}
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
</Project>
true
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.Concurrent |
true - background GCfalse - non-concurrent GC |
.NET Core 1.0 |
MSBuild property | ConcurrentGarbageCollection |
true - background GCfalse - non-concurrent GC |
.NET Core 1.0 |
Environment variable | COMPlus_gcConcurrent |
1 - background GC0 - non-concurrent GC |
.NET Core 1.0 |
Environment variable | DOTNET_gcConcurrent |
1 - background GC0 - non-concurrent GC |
.NET 6 |
app.config for .NET Framework | gcConcurrent | true - background GCfalse - non-concurrent GC |
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.Concurrent": false
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.Concurrent": false
}
}
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>
</PropertyGroup>
</Project>
Use the following settings to manage the garbage collector's memory and processor usage:
For more information about some of these settings, see the Middle ground between workstation and server GC blog entry.
n
GC heaps/threads to the first n
processors. (Use the affinitize mask or affinitize ranges settings to specify exactly which processors to affinitize.)Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapCount |
decimal value | .NET Core 3.0 |
Environment variable | COMPlus_GCHeapCount |
hexadecimal value | .NET Core 3.0 |
Environment variable | DOTNET_GCHeapCount |
hexadecimal value | .NET 6 |
app.config for .NET Framework | GCHeapCount | decimal value | .NET Framework 4.6.2 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.HeapCount": 16
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.HeapCount": 16
}
}
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to limit the number of heaps to 16, the values would be 16 for the JSON file and 0x10 or 10 for the environment variable.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapAffinitizeMask |
decimal value | .NET Core 3.0 |
Environment variable | COMPlus_GCHeapAffinitizeMask |
hexadecimal value | .NET Core 3.0 |
Environment variable | DOTNET_GCHeapAffinitizeMask |
hexadecimal value | .NET 6 |
app.config for .NET Framework | GCHeapAffinitizeMask | decimal value | .NET Framework 4.6.2 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.HeapAffinitizeMask": 1023
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.HeapAffinitizeMask": 1023
}
}
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapAffinitizeRanges |
Comma-separated list of processor numbers or ranges of processor numbers. Unix example: "1-10,12,50-52,70" Windows example: "0:1-10,0:12,1:50-52,1:7" |
.NET Core 3.0 |
Environment variable | COMPlus_GCHeapAffinitizeRanges |
Comma-separated list of processor numbers or ranges of processor numbers. Unix example: "1-10,12,50-52,70" Windows example: "0:1-10,0:12,1:50-52,1:7" |
.NET Core 3.0 |
Environment variable | DOTNET_GCHeapAffinitizeRanges |
Comma-separated list of processor numbers or ranges of processor numbers. Unix example: "1-10,12,50-52,70" Windows example: "0:1-10,0:12,1:50-52,1:7" |
.NET 6 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.HeapAffinitizeRanges": "0:1-10,0:12,1:50-52,1:7"
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.HeapAffinitizeRanges": "0:1-10,0:12,1:50-52,1:7"
}
}
Configures whether the garbage collector uses CPU groups or not.
When a 64-bit Windows computer has multiple CPU groups, that is, there are more than 64 processors, enabling this element extends garbage collection across all CPU groups. The garbage collector uses all cores to create and balance heaps.
Obs!
This is a Windows-only concept. In older Windows versions, Windows limited a process to one CPU group. Thus, GC only used one CPU group unless you used this setting to enable multiple CPU groups. This OS limitation was lifted in Windows 11 and Server 2022. Also, starting in .NET 7, GC by default uses all CPU groups when running on Windows 11 or Server 2022.
Applies to server garbage collection on 64-bit Windows operating systems only.
Default: GC does not extend across CPU groups. This is equivalent to setting the value to 0
.
For more information, see Making CPU configuration better for GC on machines with > 64 CPUs on Maoni Stephens' blog.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.CpuGroup |
false - disabledtrue - enabled |
.NET 5 |
Environment variable | COMPlus_GCCpuGroup |
0 - disabled1 - enabled |
.NET Core 1.0 |
Environment variable | DOTNET_GCCpuGroup |
0 - disabled1 - enabled |
.NET 6 |
app.config for .NET Framework | GCCpuGroup | false - disabledtrue - enabled |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
Obs!
To configure the common language runtime (CLR) to also distribute threads from the thread pool across all CPU groups, enable the Thread_UseAllCpuGroups element option. For .NET Core apps, you can enable this option by setting the value of the DOTNET_Thread_UseAllCpuGroups
environment variable to 1
.
false
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.NoAffinitize |
false - affinitizetrue - don't affinitize |
.NET Core 3.0 |
Environment variable | COMPlus_GCNoAffinitize |
0 - affinitize1 - don't affinitize |
.NET Core 3.0 |
Environment variable | DOTNET_GCNoAffinitize |
0 - affinitize1 - don't affinitize |
.NET 6 |
app.config for .NET Framework | GCNoAffinitize | false - affinitizetrue - don't affinitize |
.NET Framework 4.6.2 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.NoAffinitize": true
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.NoAffinitize": true
}
}
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimit |
decimal value | .NET Core 3.0 |
Environment variable | COMPlus_GCHeapHardLimit |
hexadecimal value | .NET Core 3.0 |
Environment variable | DOTNET_GCHeapHardLimit |
hexadecimal value | .NET 6 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.HeapHardLimit": 209715200
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.HeapHardLimit": 209715200
}
}
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to specify a heap hard limit of 200 mebibytes (MiB), the values would be 209715200 for the JSON file and 0xC800000 or C800000 for the environment variable.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitPercent |
decimal value | .NET Core 3.0 |
Environment variable | COMPlus_GCHeapHardLimitPercent |
hexadecimal value | .NET Core 3.0 |
Environment variable | DOTNET_GCHeapHardLimitPercent |
hexadecimal value | .NET 6 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.HeapHardLimitPercent": 30
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.HeapHardLimitPercent": 30
}
}
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to limit the heap usage to 30%, the values would be 30 for the JSON file and 0x1E or 1E for the environment variable.
You can specify the GC's heap hard limit on a per-object-heap basis. The different heaps are the large object heap (LOH), small object heap (SOH), and pinned object heap (POH).
DOTNET_GCHeapHardLimitSOH
, DOTNET_GCHeapHardLimitLOH
, or DOTNET_GCHeapHardLimitPOH
settings, you must also specify a value for DOTNET_GCHeapHardLimitSOH
and DOTNET_GCHeapHardLimitLOH
. If you don't, the runtime will fail to initialize.DOTNET_GCHeapHardLimitPOH
is 0. DOTNET_GCHeapHardLimitSOH
and DOTNET_GCHeapHardLimitLOH
don't have default values.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitSOH |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitSOH |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitSOH |
hexadecimal value | .NET 6 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitLOH |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitLOH |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitLOH |
hexadecimal value | .NET 6 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitPOH |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitPOH |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitPOH |
hexadecimal value | .NET 6 |
These configuration settings don't have specific MSBuild properties. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to specify a heap hard limit of 200 mebibytes (MiB), the values would be 209715200 for the JSON file and 0xC800000 or C800000 for the environment variable.
You can specify the GC's heap hard limit on a per-object-heap basis. The different heaps are the large object heap (LOH), small object heap (SOH), and pinned object heap (POH).
DOTNET_GCHeapHardLimitSOHPercent
, DOTNET_GCHeapHardLimitLOHPercent
, or DOTNET_GCHeapHardLimitPOHPercent
settings, you must also specify a value for DOTNET_GCHeapHardLimitSOHPercent
and DOTNET_GCHeapHardLimitLOHPercent
. If you don't, the runtime will fail to initialize.DOTNET_GCHeapHardLimitSOH
, DOTNET_GCHeapHardLimitLOH
, and DOTNET_GCHeapHardLimitPOH
are specified.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitSOHPercent |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitSOHPercent |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitSOHPercent |
hexadecimal value | .NET 6 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitLOHPercent |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitLOHPercent |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitLOHPercent |
hexadecimal value | .NET 6 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HeapHardLimitPOHPercent |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHeapHardLimitPOHPercent |
hexadecimal value | .NET 5 |
Environment variable | DOTNET_GCHeapHardLimitPOHPercent |
hexadecimal value | .NET 6 |
These configuration settings don't have specific MSBuild properties. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to limit the heap usage to 30%, the values would be 30 for the JSON file and 0x1E or 1E for the environment variable.
Memory load is indicated by the percentage of physical memory in use. By default, when the physical memory load reaches 90%, garbage collection becomes more aggressive about doing full, compacting garbage collections to avoid paging. When memory load is below 90%, GC favors background collections for full garbage collections, which have shorter pauses but don't reduce the total heap size by much. On machines with a significant amount of memory (80GB or more), the default load threshold is between 90% and 97%.
The high memory load threshold can be adjusted by the DOTNET_GCHighMemPercent
environment variable or System.GC.HighMemoryPercent
JSON configuration setting. Consider adjusting the threshold if you want to control heap size. For example, for the dominant process on a machine with 64GB of memory, it's reasonable for GC to start reacting when there's 10% of memory available. But for smaller processes, for example, a process that only consumes 1GB of memory, GC can comfortably run with less than 10% of memory available. For these smaller processes, consider setting the threshold higher. On the other hand, if you want larger processes to have smaller heap sizes (even when there's plenty of physical memory available), lowering this threshold is an effective way for GC to react sooner to compact the heap down.
Obs!
For processes running in a container, GC considers the physical memory based on the container limit.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.HighMemoryPercent |
decimal value | .NET 5 |
Environment variable | COMPlus_GCHighMemPercent |
hexadecimal value | .NET Core 3.0 .NET Framework 4.7.2 |
Environment variable | DOTNET_GCHighMemPercent |
hexadecimal value | .NET 6 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to set the high memory threshold to 75%, the values would be 75 for the JSON file and 0x4B or 4B for the environment variable.
false
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.RetainVM |
false - release to OStrue - put on standby |
.NET Core 1.0 |
MSBuild property | RetainVMGarbageCollection |
false - release to OStrue - put on standby |
.NET Core 1.0 |
Environment variable | COMPlus_GCRetainVM |
0 - release to OS1 - put on standby |
.NET Core 1.0 |
Environment variable | DOTNET_GCRetainVM |
0 - release to OS1 - put on standby |
.NET 6 |
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.RetainVM": true
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.RetainVM": true
}
}
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RetainVMGarbageCollection>true</RetainVMGarbageCollection>
</PropertyGroup>
</Project>
0
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | N/A | N/A | N/A |
Environment variable | COMPlus_GCLargePages |
0 - disabled1 - enabled |
.NET Core 3.0 |
Environment variable | DOTNET_GCLargePages |
0 - disabled1 - enabled |
.NET 6 |
1
.Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | N/A | N/A | N/A |
Environment variable | COMPlus_gcAllowVeryLargeObjects |
1 - enabled0 - disabled |
.NET Core 1.0 |
Environment variable | DOTNET_gcAllowVeryLargeObjects |
1 - enabled0 - disabled |
.NET 6 |
app.config for .NET Framework | gcAllowVeryLargeObjects | 1 - enabled0 - disabled |
.NET Framework 4.5 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.LOHThreshold |
decimal value | .NET Core 3.0 |
Environment variable | COMPlus_GCLOHThreshold |
hexadecimal value | .NET Core 3.0 |
Environment variable | DOTNET_GCLOHThreshold |
hexadecimal value | .NET 6 |
app.config for .NET Framework | GCLOHThreshold | decimal value | .NET Framework 4.8 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
runtimeconfig.json file:
{
"runtimeOptions": {
"configProperties": {
"System.GC.LOHThreshold": 120000
}
}
}
runtimeconfig.template.json file:
{
"configProperties": {
"System.GC.LOHThreshold": 120000
}
}
Tips
If you're setting the option in runtimeconfig.json, specify a decimal value. If you're setting the option as an environment variable, specify a hexadecimal value. For example, to set a threshold size of 120,000 bytes, the values would be 120000 for the JSON file and 0x1D4C0 or 1D4C0 for the environment variable.
To use a standalone garbage collector instead of the default GC implementation, you can specify either the path (in .NET 9 and later versions) or the name of a GC native library.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.Path |
string_path | .NET 9 |
Environment variable | DOTNET_GCPath |
string_path | .NET 9 |
Specifies the name of a GC native library that the runtime loads in place of the default GC implementation. The behavior changed in .NET 9 with the introduction of the Path config.
In .NET 8 and previous versions:
In .NET 9 and later versions, this value specifies a file name only (paths aren't allowed):
Main
method resides.This configuration setting is ignored if the Path config is specified.
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.Name |
string_name | .NET 7 |
Environment variable | COMPlus_GCName |
string_name | .NET Core 2.0 |
Environment variable | DOTNET_GCName |
string_name | .NET 6 |
Setting name | Values | Version introduced | |
---|---|---|---|
runtimeconfig.json | System.GC.ConserveMemory |
0 - 9 |
.NET 6 |
Environment variable | COMPlus_GCConserveMemory |
0 -9 |
.NET Framework 4.8 |
Environment variable | DOTNET_GCConserveMemory |
0 -9 |
.NET 6 |
app.config for .NET Framework | GCConserveMemory | 0 -9 |
.NET Framework 4.8 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
Example app.config file:
<configuration>
<runtime>
<GCConserveMemory enabled="5"/>
</runtime>
</configuration>
Tips
Experiment with different numbers to see which value works best for you. Start with a value between 5 and 7.
Setting name | Values | Version introduced | |
---|---|---|---|
Environment variable | DOTNET_GCDynamicAdaptationMode |
1 - enabled0 - disabled |
.NET 8 |
MSBuild property | GarbageCollectionAdaptationMode |
1 - enabled0 - disabled |
.NET 8 |
runtimeconfig.json | System.GC.DynamicAdaptationMode |
1 - enabled0 - disabled |
.NET 8 |
This configuration setting doesn't have a specific MSBuild property. However, you can add a RuntimeHostConfigurationOption
MSBuild item instead. Use the runtimeconfig.json setting name as the value of the Include
attribute. For an example, see MSBuild properties.
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding:
Hendelser
17. mars, 21 - 21. mars, 10
Bli med i meetup-serien for å bygge skalerbare AI-løsninger basert på virkelige brukstilfeller med andre utviklere og eksperter.
Registrer deg nå