Hi, I've recently tracked down a memory leak in my application and I'd like to add a test case to check that it stays that way. What I want to do is this:
int numberOfInstancesBeforeFunction = GetNumberOfInstancesInMemory(typeof(MyClass));
PerformFunction();
GC.Collect();
int numberOfInstancesAfterFunction = GetNumberOfInstancesInMemory(typeof(MyClass));
Assert.AreEqual(numberOfInstancesBeforeFunction, numberOfInstancesAfterFunction, "mem leak");
Is this possible?
Thanks,
Euan