Can anyone explain why this causes a memory leak?
C#
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 rajhans2 pointsPosted Jan 31, 2011, 3:02 PM EST
I am facing same problem.
Can you please provide the object code. How did you implement that ?