Search code examples
c#wpfdllmemory-leaksmsvcrt

How to find the dll which causes a memory leak and not directly referenced by application


I am writing a WPF application which uses a number of unmanaged DLL's. Something in the program is causing memory leak and I monitored the application using Redgate ANTS 8 Memory Profiler. ANTS shows that the memory usage of MSVCR110.dll is constantly increasing.

The question is that can managed code cause this leak by using MSVCR110.dll?

If not can I find which of the unmanaged dll's is using MSVCR110.dll and causing leak?

(My program has reference to MSVCR110.dll directly.)


Solution

  • The answer was not easy to find. I had tried each DLL that I suspected one by one. The leak was an undeleted array in a C++/CLI wrapper class. Since it is a managed dll, I think, the native "new" calls are traced through msvcr110.dll, and ANTS shows leak in that dll.