Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn off Concurrent Garbage Collection?

Tags:

c#

.net

I'm trying to run Microsoft's CLR Profiler on an application of ours. It's a C#/.Net 4.0 app which controls industrial machinery at factories.

Microsoft's CLR Profiler dramatically slows down the target applications (10X to 100X, according to its author, Peter Sollich). In our case it slows down our app so much that it fails because the network equipment our app is talking-to times out during the lengthy process when the program first starts up of establishing connections with devices on the factory floor.

So what I want to do is start our app and let it finish its initialization and THEN attach the profiler. When I try that CLR Profiler says I have to "Turn off concurrent GC in the application's configuration file" for that to work.

Where exactly is the setting it's referring to? What is the configuration file and how can I access the setting in Visual Studio 2010?

like image 236
user316117 Avatar asked Feb 09 '14 19:02

user316117


People also ask

What is concurrent garbage collector?

Concurrent garbage collection enables interactive applications to be more responsive by minimizing pauses for a collection. Managed threads can continue to run most of the time while the concurrent garbage collection thread is running. This design results in shorter pauses while a garbage collection is occurring.

How does concurrent Mark and Sweep work?

Concurrent Mark Sweep Collector Concurrent Phases After the remark pause, a concurrent sweeping phase collects the objects identified as unreachable. After a collection cycle completes, the CMS collector waits, consuming almost no computational resources, until the start of the next major collection cycle.

Who performs garbage collection in .NET core?

When the application calls a new operator to create an object, there might not be enough space left in the managed heap to allocate the object. In case of insufficient space, CLR performs garbage collection, which works in the generations.


1 Answers

Modify or create an App.Config file and set the following code

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

This is from MSDN: How to: Disable Concurrent Garbage Collection. For more information on creating an App.Config look here

like image 185
Phillip Scott Givens Avatar answered Oct 15 '22 21:10

Phillip Scott Givens