Specifies whether the common language runtime runs garbage collection on a separate thread.
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Specifies whether the runtime runs garbage collection concurrently.
Does not run garbage collection concurrently.
Runs garbage collection concurrently. This is the default.
The root element in every configuration file used by the common language runtime and .NET Framework applications.
Contains information about assembly binding and garbage collection.
Prior to the .NET Framework 4, workstation garbage collection supported concurrent garbage collection, which performed garbage collection in the background on a separate thread. In the .NET Framework 4, concurrent garbage collection was replaced by background GC, which also performs garbage collection in the background on a separate thread. Starting with the .NET Framework 4.5, background collection became available in server garbage collection. The <gcConcurrent> element controls whether the runtime performs either concurrent or background garbage collection, if it is available, or whether it performs garbage collection in the foreground.
Starting with the .NET Framework 4, concurrent garbage collection is replaced by background garbage collection. The terms concurrent and background are used interchangeably in the .NET Framework documentation. To disable background garbage collection, use the <gcConcurrent> element, as discussed in this article.
By default, the runtime uses concurrent or background garbage collection, which is optimized for latency. If your application involves heavy user interaction, leave concurrent garbage collection enabled to minimize the application's pause time to perform garbage collection. If you set the enabled attribute of the <gcConcurrent> element to false, the runtime uses non-concurrent garbage collection, which is optimized for throughput. The following configuration file disables background garbage collection.
If there is a <gcConcurrentSetting> setting in the machine configuration file, it defines the default value for all .NET Framework applications. The machine configuration file setting overrides the application configuration file setting.
For more information on concurrent and background garbage collection, see the "Concurrent garbage collection" section in the Fundamentals of Garbage Collection topic.
The following example enables concurrent garbage collection.
<configuration> <runtime> <gcConcurrent enabled="true"/> </runtime> </configuration>