How to enable CLR Server GC?

This is one of the mostly asked questions about CLR GC.

CLR's GC has two modes: Server GC and WorkStation GC. The difference is discussed briefly in Gregor Noriski's MSDN article about writing high performance managed application(

In .Net framework 1.0 and 1.1, the only supported way to enable server GC is going through CLR's hosting API. Steven Pratschner provided a sample in a newsgroup post:

In Whidbey (.Net framework 2.0) and 1.1 Service Pack 1, CLR introduces a config file option to enable server GC. The syntax is following:

        <gcServer enabled=“true“ />

This can be put in app.config or machine.config. App.config is preferred so that it won't affect all the applications on the machine.

In .Net framework 1.1 you can check if Server GC is enabled by checking whether mscorwks.dll or mscorsvr.dll is loaded. If mscorsvr.dll is loaded, then Server GC is enabled.

In Whidbey mscorsvr.dll is merged into mscorwks.dll, so the above technique will not work. Instead, System.Environment.IsServerGC should be used to check against Server GC.

This config file should work with Whidbey Beta1 and .Net framework 1.1 SP1 Technical Preview. Both are available now.

Comments (9)

  1. As one writer explains, one of the most common asked questions about CLR GC is: "How to enable CLR Server GC?" Well, here you will find out about a config file that allows you to accomplish this task. Short, but…

  2. Server GC ? WorkStation GC ???(.Net framework 1.1 SP1)

  3. David M. Kean says:

    Wouldn’t the IsServerGC be better placed on System.GC class, as it applies to the Garbage Collector?

  4. David,

    This is a good question. The original thinking is that this describes the state of the system. We will evaluate your suggestion. Since Whidbey is still in beta1, we still have time to make a change.

  5. In the previous posts in this series, we have looked at a multitude of features provided by the PFX June

Skip to main content