Page 1 of 1

Finding Leaks based on namespace or assemblies

Posted: Fri Jun 01, 2012 5:33 am
by idris
Hi,
Is it possible to find the leaks from some namespaces and do not consider other namespaces/assmeblies?
The idea behind this is when i run the test cases (using MS Test) i want to find the leak only from my application and not from my test framework. For e.g. if the MemoryStream is allocated by my application and not disposed then profiler should show this causes leak. If the MemoryStream is created by test framework then it should not show this as leak (I am not interested in leak of test framework). Is this anyway to achieve this using the API?
I am using V3.5 profiler.

- Idris

Re: Finding Leaks based on namespace or assemblies

Posted: Mon Jun 04, 2012 9:10 am
by Andreas Suurkuusk
The .NET Memory Profiler API can only be used to detect potential memory leaks based on the Type of instances. It cannot (currently) filter on the allocation call stack.

Additionally, it is not possible to assert on undisposed instances (e.g. MemoryStreams) using the API. The API can only be used to detect whether instances have been GCed as expected. Including additional assertions, such as "NoUndisposedInstances" is probably a good idea and something we will consider for a future version.

However, you can avoid presenting information about undisposed instances created by the testing framework by ignoring the issues based on the allocation call stack or allocation method. Just click in the "Ignore" link in the issue and then ignore the issued by allocation (see screenshot).
IgnoreIssue.png
Ignore analysis issue