Garbage Collector Deathmatch - 'There can be only one'

I was talking to “Biztalk” Bill Chesnut today about Garbage Collection. I was vaguely aware that there were actually 2 garbage collectors in .NET 1.x, one optimized for workstations and another for servers (mscorwks.dll and mscorsvr.dll respectively). It seems that in .NET 2.0 mscorsvr.dll has been absorbed into mscorwks.dll which has doubled in size, and it is/will be possible to select which version of GC you want via app.config. Server GC partitions the managed heap out into a number of sections (1 for each CPU), and when a collection is initiated the garbage collector gets one thread per CPU. Server GC suspends CLR threads during GC, while workstation GC performs GC in parallel with CLR threads. Presumably this is so that smart-client applications don’t “lock” while GC is happening.

K. Scott Allen has some interesting info on this also with respect to some .NET framework 1.0 settings that SOUND like they do what is coming in framework 2.0, but actually don’t.

Update: in the comments William Luu points to these two very applicable posts from Chris Lyon [1,2] (and sorry to Chris for spelling his fairly straightforward second name wrong).

Update 2:It seems that there aren’t just 2 flavours of GC but three - Server GC and two workstation flavours, one with concurrent GC ON and another with it OFF. More info here:


William Luu
Hi Joseph, here’s 2 more blog entries by Chris Lyon (he’s a .NET GC Tester) you could take a look at that I spotted over the weekend, relating to the two GCs in .NET 1.x.
12/09/2004 10:17:00 PM
Chris Lyon [MSFT]
There’s no ’s’ in Lyon ;)
20/09/2004 9:24:00 AM