Compartir a través de


<gcConcurrent> Element

Specifies whether the common language runtime runs garbage collection on a separate thread.

<configuration>
   <runtime>
      <gcConcurrent>

<gcConcurrent 
   enabled="true|false"/>

Required Attribute

Attribute Description
enabled Specifies whether the runtime runs garbage collection concurrently. Use one of the following values:
true
Runs garbage collection concurrently. This is the default.
false
Does not run garbage collection concurrently.

Remarks

The setting in the machine configuration file is the default for all .NET Framework applications. The application configuration file setting overrides the machine configuration file setting.

If your application is single-threaded and involves heavy user interaction, leave concurrent garbage collection enabled to minimize the application's pause time to perform garbage collection. If your application is an ASP.NET server application you do not need to alter the default value of the gcConcurrent element.

Example

The following example shows how to disable garbage collection.

<configuration>
   <runtime>
      <gcConcurrent enabled="false"/>
   </runtime>
</configuration>

Configuration File

This element can be used in the application configuration file, and the machine configuration file (machine.config).

See Also

Runtime Settings Schema | Configuration File Schema | Specifying Concurrent Garbage Collection