Whilst developing low latency software on .NET, we have discovered a serious bug in the .NET 4 concurrent workstation garbage collector that can cause applications to hang for up to several minutes at a time. On three of our machines the following simple C# program causes the GC to leak memory until none remains and a single mammoth GC cycle kicks in, stalling the program for several minutes (!) while 11Gb of heap is recycled: static void Main(string[] args) {
var q = new System.Collections.Generic.Queue<System.Object>();
while (true) {
q.Enqueue(0);
if (q.Count > 1000000)
q.Dequeue();
}
}
You need to compile for x64 on a 64-bit Windows OS with .NET 4 and run with the default (concurrent workstation) GC using the default (interactive) latency setting.Read more: The Flying Frog Blog
var q = new System.Collections.Generic.Queue<System.Object>();
while (true) {
q.Enqueue(0);
if (q.Count > 1000000)
q.Dequeue();
}
}
You need to compile for x64 on a 64-bit Windows OS with .NET 4 and run with the default (concurrent workstation) GC using the default (interactive) latency setting.Read more: The Flying Frog Blog
0 comments:
Post a Comment