Here's a simple test to reproduce the problem, this is the only class in the entire project, and there are no other links:
[TestFixture]
public class ObjectFactoryTests
{
[Test]
public void ResetMemoryLeak()
{
for (int i = 1; i < 1000; i++)
{
ObjectFactory.Reset();
if (i % 10 == 0)
{
GC.Collect();
GC.WaitForFullGCComplete();
Console.WriteLine(GC.GetTotalMemory(true));
}
}
}
}
The output shows steady growth:
498720
509668
...
794072
796952
Does anyone know what the problem is?
source
share