Chris Lyon's WebLog

Or How I Learned To Stop Worrying And Love The GC

Browse by Tags

Tagged Content List
  • Blog Post: New In Orcas Part 3: GC Latency Modes

    As you may know, there are different GC modes to choose from depending on the type of application you’re using: Server GC, Workstation GC, and Concurrent GC ( more info ). These settings are process-wide, set at the beginning of the process. Once the GC mode is set, it cannot be changed. In Orcas, we...
  • Blog Post: New In Orcas Part 2: GC Collection Modes

    In Orcas we’ve added an overload to System.GC.Collect(): void System.GC.Collect(int generation, System.GCCollectionMode mode) Where generation is the highest generation to collect (from 0 to System.GC.MaxGeneration) and mode can be: Default: the same behavior if you called GC.Collect without...
  • Blog Post: New In Orcas Part 1: What we’ve been doing

    The Orcas March CTP is out, and what does that mean for the Garbage Collector? The GC team has been concentrating on three areas for this release: Bug fixes. For Orcas, we’ve fixed several premature Out of Memory bugs, improved stability in certain stressful conditions, and even improved performance...
  • Blog Post: When GC.KeepAlive Doesn’t

    The purpose of GC.KeepAlive(Object) is to tell the GC not to collect an object until a certain point. For example: class MyObject { ~MyObject() { Console.WriteLine(“MyObject Finalized”); } public static void Main() { MyObject obj = new MyObject(); LongRunningMethod(); GC.KeepAlive(obj); // ...
  • Blog Post: Object Resurrection

    I’m sure many of you have heard the term “object resurrection” with respect to the GC. It’s an interesting (but not very useful) way to illustrate object lifetimes and the role of finalization versus garbage collection. Basically, it’s a way to reference an object that has been finalized. Here...
  • Blog Post: How To Tell Which GC Mode Your Application Is Using

    I posted previously about how to set the GC mode your application. So now that you’re running your app, how do you know it’s running in that GC mode? If you’re using v1.0 or v1.1, the CLR loads a different dll based on which GC mode (mscorwks.dll for workstation, mscorsvr.dll for server). You can use...
  • Blog Post: To Null or Not to Null

    GC Myth: setting an object's reference to null will force the GC to collect it right away. GC Truth: setting an object's reference to null will sometimes allow the GC to collect it sooner. As much as you may want to, you can't guarantee the GC will collect what you want, when you want it to. The best...
  • Blog Post: Part 2 in Maoni's Using GC Efficiently

    Maoni posted Part 2 to Using the GC Efficiently. A very in-depth article about Server, Workstation and Concurrent GC. Check it out.
  • Blog Post: GCHandles, Boxing and Heap Corruption

    A GCHandle is a struct used to hold onto a managed object to be used by unmanaged code. With a GCHandle you can (among other things): Prevent an object from being garbage collected if unmanaged code has the only live reference to it Pin an object in memory, so it won’t be relocated in memory by the garbage...
  • Blog Post: A Few Good GC Links

    I keep a GC folder in my Favorites full of links to articles and blog posts about the .NET GC. I thought it would be a good idea to consolidate them all into one blog post, for handy reference. These are the articles I most often post as answers to questions on public newsgroups. If you know of any other...
  • Blog Post: Server GC Misconceptions

    One of the most common “bugs” I read about on the Microsoft public newsgoups is the fact that the runtime does not automatically choose Server GC mode on a multi-proc machine, or server OS. If the server OS is running on a single-proc machine then the runtime will have to load the Workstation GC, since...
  • Blog Post: Server, Workstation and Concurrent GC

    One common question I see asked is the differences between server and workstation GC, and how Concurrent GC fits in. Server GC is only available on multi-proc machines. It creates one GC heap (and thus one GC thread) for each processor, which are collected in parallel. This GC mode maximizes throughput...
Page 1 of 1 (12 items)