<gcServer> Element

 

Specifies whether the common language runtime runs server garbage collection.

<configuration>
<runtime>
<gcServer>

<gcServer    
   enabled="true|false"/>  

The following sections describe attributes, child elements, and parent elements.

Attributes

AttributeDescription
enabledRequired attribute.

Specifies whether the runtime runs server garbage collection.
ValueDescription
falseDoes not run server garbage collection. This is the default.
trueRuns server garbage collection.

Child Elements

None.

Parent Elements

ElementDescription
configurationThe root element in every configuration file used by the common language runtime and .NET Framework applications.
runtimeContains information about assembly binding and garbage collection.

The common language runtime (CLR) supports two types of garbage collection: workstation garbage collection, which is available on all systems, and server garbage collection, which is available on multiprocessor systems. You use the <gcServer> element to control the type of garbage collection the CLR performs. Use the GCSettings.IsServerGC property to determine if server garbage collection is enabled.

For single-processor computers, the default workstation garbage collection should be the fastest option. Either workstation or server can be used for two-processor computers. Server garbage collection should be the fastest option for more than two processors.

This element can be used only in the application configuration file; it is ignored if it is in the machine configuration file.

System_CAPS_ICON_note.jpg Note

In the .NET Framework 4 and earlier versions, concurrent garbage collection is not available when server garbage collection is enabled. Starting with the .NET Framework 4.5, server garbage collection is concurrent. To use non-concurrent server garbage collection, set the <gcServer> element to true and the <gcConcurrent> element to false.

The following example enables server garbage collection.

  
<configuration>  
   <runtime>  
      <gcServer enabled="true"/>  
   </runtime>  
</configuration>  
  

GCSettings.IsServerGC
Runtime Settings Schema
Configuration File Schema
How to: Disable Concurrent Garbage Collection

Show: