Can anyone explain why this causes a memory leak?
static void Main() { Thread outerThread = new Thread(delegate() { while (true) { Thread innerThread = new Thread(delegate() { }); innerThread.Start(); Thread.Sleep(10); } }); outerThread.Start();
Application.Run(); }
By the way, if instead of creating an inner thread I just create an object, the garbage collector does its job and no memory leak occurs.