How do I disable concurrent GC (Visual Studio 2010)?

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
ChuckHeatherly
Posts: 2
Joined: Wed May 11, 2011 5:29 pm

How do I disable concurrent GC (Visual Studio 2010)?

Post by ChuckHeatherly » Wed May 11, 2011 5:43 pm

I am using .NET Memory Profiler version 4.0.38.0 on Windows 7 Enterprise 64-bit (haven't installed SP1 yet, our site admin hasn't released it). I have a console application project in Visual Studio 2010 Premium with Service Pack 1. I've set a breakpoint in the application; when I run to it and try to attach to the process (tried both x86 and x64), I get this error:

Cannot Attach (concurrent GC enabled)

The process 'XYZ.vshost.exe' (5900) has concurrent GC enabled. It is not possible to attach to this process using the .NET profiling API. You need to disable concurrent GC or enable the server GC to attach to this process, or you can attach using Debugging Tools (which is much slower).

There is a label on the error dialog titled '? Click here for information on how to disable concurrent GC', but it is disabled / grayed out, I cannot click it.

I've looked through the Debugger options in Visual Studio 2010, I don't see anything labeled concurrent or server GC. Where is this option configured? And why is the 'Click here for information' label disabled in the error dialog?

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: How do I disable concurrent GC (Visual Studio 2010)?

Post by Andreas Suurkuusk » Thu May 12, 2011 4:35 pm

To disable the concurrent GC you need to add a <gcConcurrent> element to the app.config file, like the example below.

Code: Select all

<?xml version="1.0"?>
<configuration>
  <runtime>
    <gcConcurrent enabled="false" />
  </runtime>
</configuration>
The link on the error dialog is supposed to open the documentation about this, but the documentation has not been updated in the current preview of version 4.0. That's why the link is currently disabled.
Best regards,

Andreas Suurkuusk
SciTech Software AB

ChuckHeatherly
Posts: 2
Joined: Wed May 11, 2011 5:29 pm

Re: How do I disable concurrent GC (Visual Studio 2010)?

Post by ChuckHeatherly » Thu May 12, 2011 4:50 pm

So this option has to be configured for every application that is profiled? There's no way to set the option globally?

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: How do I disable concurrent GC (Visual Studio 2010)?

Post by Andreas Suurkuusk » Thu May 12, 2011 9:26 pm

You can set this option globally be editing the machine.config file. Just add the <gcConcurrent enabled="false" /> element under the <runtime> element in machine.config. However, this will cause all .NET applications to run with concurrent GC disabled, even if they are not being profiled. This will cause a performance degradation, but I'm not sure how significant it will be.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests