Let's say I want to execute some command on many threads. I'd have this example code:
for (int i = 0; i < 5000; i++)
        {
            new Thread(() =>
            {
                while (true)
                {
                    string foo = "foo " + DateTime.Now.Ticks;
                    bool breakout = false;
                    for (int j = 0; j < random.Next(10, 100); j++)
                    {
                        string bar = "bar " + DateTime.Now.Ticks;
                        if (j == 5)
                        {
                            continue;
                        }
                        if (j == 8)
                        {
                            breakout = true;
                            break;
                        }
                    }
                    if (breakout)
                    {
                        continue;
                    }
                    string baz = "baz " + DateTime.Now.Ticks;
                }
            }).Start();
        }
This code example, creating 5K threads and setting some strings, leaks memory as far as I am concerned. As the code runs, the memory usage crawls higher and higher. Now, I think this is because I am setting variables and then abandoning them - is there a way I can continue/break without memory usage increasing more and more?
 
    