Problem:
Recently I started to face an issue on one of my project that contains around 650 unit tests.
When I run all of them at once, some tests near the end of the unit test run start failing with a System.OutOfMemoryException.
When I re-run the failing test again, they pass.
Analysis:
I looked at the task manager while running my test to see that the vstest.executionengine.x86.exe always increases until it reach 1330 MB of memory. Then the tests starts failing with the out of memory exception.
Of course im sure that its possible that a few of my classes may have a memory leak, but 90% of my classes under test doesn't have such code that could lead to memory leaks.
Many of my tests class doesn't have any TestInitialize or TestCleanup method since the creation of my classes are done directly inside the TestMethod test and since those classes under test doesn't implement IDiposable (since there is no code that could lead to leaks).
Questions:
Now I am not sure what I might be doing wrong. But I'm wondering how come test objects remains in memory even after all the tests of a test class were run?
Has anyone experienced this or could point me to what I should/could do to fix or locate the problem?
Thanks!