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.
ravi rajhansPosted Jan 31, 2011, 8:02 PM
I am facing same problem.
Can you please provide the object code. How did you implement that ?