Export (0) Print
Expand All

How to: Disable Concurrent Garbage Collection

The common language runtime (CLR) can run garbage collection either concurrently on a separate thread or on the same thread as the application. Use the <gcConcurrent> element in your application's configuration file to specify how the runtime should run garbage collection.

Note Note

To disable concurrent garbage collection, you must either create or edit your application's configuration file. For more information on application configuration files and their format, see Configuration Files.

By default, the runtime uses concurrent garbage collection, which is optimized for latency. 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 shows how to disable concurrent garbage collection.

       <gcConcurrent enabled="false"/>

If your application involves heavy user interaction, leave concurrent garbage collection enabled so the application does not pause to perform garbage collection.

Caution noteCaution

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 described in this article.

© 2015 Microsoft