Reputation: 355
I'm struggling to understand how can I change the garbage collector mode on .NET 4.0 from Workstation to Concurrent mode. I've found out I need to add these lines to some config file:
<configuration>
<runtime>
<gcConcurrent enabled="true"/>
</runtime>
</configuration>
However, I'm not sure what configuration file they mean here. Nevertheless, I went to the machine.config under C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config hoping that this was a machine-wide setting and still that didn't help. I noticed my dlls also had their own config files, but updating those also didn't help. Note that my application doesn't have an app.config.
Later on I've run a test dll in nunit, where I also wanted to set the GC mode to Concurrent. So I thought I should configure nunit: nunit-x86.exe.config under C:\Program Files (x86)\NUnit 2.6.2\bin. This also didn't have any effect.
Any clues ? Which config file should I update ?
Thanks, Greetings, Sorin
Upvotes: 3
Views: 909
Reputation: 941455
There are several possible reasons for this. Off the top of my head:
<gcServer>
element in the .config fileNot much point at guessing at this when you can see which .config file is being used. Run Fuslogvw.exe from the elevated Visual Studio Command Prompt (right-click the shortcut and choose Run as Administrator). Click Settings and tick "Log all binds to disk". Run your program. Click Refresh and look at one of the log entries, you'll see a line that resembles:
LOG: Using application configuration file: c:\projects2\ConsoleApplication43\bin\Debug\ConsoleApplication43.vshost.exe.Config
Just an example, this one was generated for a dummy console mode app, started with F5 and with the Hosting Process option ticked in the project's Debug tab.
Upvotes: 3
Reputation: 398
AFAIK the concurrent mode is by default enabled.
By default, the runtime uses concurrent garbage collection, which is optimized for latency. If you set the enabled attribute of the element to false, the runtime uses non-concurrent garbage collection, which is optimized for throughput. The following shows how to disable concurrent garbage collection.
Please check http://msdn.microsoft.com/en-us/library/at1stbec(v=vs.110).aspx
Upvotes: 2