My project is currently using Isolator 5.3.1.0 in 900+ tests with MSTest. When attempting to run a large group of them, we find that VSTestHost.exe is quickly burning through memory. Eventually, everything just grinds to a halt and we have to kill VSTestHost. I set up a little test to see what was going on:
public class EmptyClass
{
}
[TestClass]
public class MemoryTest
{
[TestCleanup]
public void Cleanup()
{
Isolate.CleanUp();
}
[TestMethod]
public void TestEmpty()
{
for (int i = 0; i < 10000; i++)
{
EmptyClass empty = Isolate.Fake.Instance<EmptyClass>();
}
}
[TestMethod]
public void TestNothing()
{
for (int i = 0; i < 100000000; i++)
{
EmptyClass empty = new EmptyClass();
}
}
[TestMethod]
public void TestOther()
{
for (int i = 0; i < 50; i++)
{
OtherClass test = Isolate.Fake.Instance<OtherClass>();
}
}
}
Running TestEmpty slowly increases the memory usage, visible by a change roughly 100-300K every time the Windows Task Manager screen updates.
Running TestNothing does not increase the memory usage over time. VSTestHost.exe gets to about 80K and then stays there for the duration of the test.
Running TestOther (OtherClass is a fairly large class in my project) increases the memory usage by 4000-7000K every time the screen updates. Based on this, you can see why I limited the run to 50 times.
Is there some way to prevent this memory accumulation from happening?