Test Driven Development of a Generational Garbage Collection

These days everyone is talking about being agile and test driven development (TDD). I wanted to share a success story of TDD that we employed for developing Generational Garbage Collector (GC) for Windows Phone Mango. The .NET runtime on Windows Phone 7 shipped with a mark-sweep-compact; stop the world global non-generational GC. Once a GC…


WP7 Mango: The new Generational GC

In my previous post “Mark-Sweep collection and how does a Generational GC help” I discussed how a generational Garbage Collector (GC) works and how it helps in reducing collection latencies which show up as long load times (startup as well as other load situations like game level load) and gameplay or animation jitter/glitches. In this…


WP7 Mango: Mark-Sweep collection and how does a Generational GC help

About a month back we announced that in the next release of Windows Phone 7 (codenamed Mango) we will ship a new garbage collector in the CLR. This garbage collector (GC) is a generational garbage collector. This post is a “back to basics” post where I’ll try to examine how a mark-sweep GC works and…


Generational GC in Windows Phone Mango

  This is an announcement only post, do subscribe to this blog feed or on to https://twitter.com/abhinaba as I’d be making more detailed posts on how we are building the Generational GC and what developers need to know. Today in the MIX11 keynote ScottGu just announced something that I’ve been working on for some time….


WP7: When does GC Consider a Local Variable as Garbage

  Consider the following code that I received: static void Foo() { TestClass t = new TestClass(); List<object>l = new List<object>(); l.Add(t); // Last use of l and t WeakReference w = new WeakReference(t); GC.Collect(); GC.WaitForPendingFinalizers(); Console.WriteLine("Is Alive {0}", w.IsAlive); } If this code is is run on the desktop it prints Is Alive False….


Windows Phone 7 App Development: When does the GC run

If you are looking for information on the new Generational GC on Windows Phone Mango please visit http://blogs.msdn.com/b/abhinaba/archive/2011/06/14/wp7-mango-the-new-generational-gc.aspx Many moons ago I made a post on When does the .NET Compact Framework Garbage Collector run. Given that a lot of things have changed since then, it’s time to make another post about the same thing….


Back to Basics: Memory leaks in managed systems

Someone contacted me over my blog about his managed application where the working set goes on increasing and ultimately leads to out of memory. In the email at one point he states that he is using .NET and hence there should surely be no leaks. I have also talked with other folks in the past…


NETCF: Count your bytes correctly

I got a stress related issue reported in which the code tried allocating a 5MB array and do some processing on it but that failed with OOM (Out of Memory). It also stated that there was way more than 5 MB available on the device and surely it’s some bug in the Execution Engine. Here’s…


NETCF: GC and thread blocking

One of our customers asked us a bunch of questions on the NETCF garbage collector that qualifies as FAQ and hence I thought I’d put them up here. Question: What is the priority of the GC thread Answer: Unlike some variants of the desktop GC and other virtual machines (e.g. JScript) we do not have…


How does the .NET Compact Memory allocator work

As I mentioned in one of my previous posts the .NET Compact Framework uses 5 separate heaps of which one is dedicated for managed data and is called the managed heap. The .NETCF allocator, allocates pools of data from this managed heap and then sub-allocates managed objects from this pool. This is how the process…