Tools for detecting memory leaks for C # and an unmanaged C ++ application

We have an application developed in C # .NET Framework 2.0 that interacts with a COM component (which is developed in unmanaged C ++ code). Sometimes an application throws an exception in memory (quite difficult to reproduce).

We would like to have a tool to find out if we have a memory leak and identify the root cause of the memory exception. What tools are best for this? An ideal tool will be able to connect to an ongoing process on a user machine for analysis.

We tried the .NET memory profiler, but we can only connect to the .NET Framework 4.0. We also used the Memory Validator (C ++ memory leak detector); however, this tool did not give us sufficient hints when connected to the current process.

+6
source share
4 answers

Short answer

Have you tried Microsoft Application Verifier ? It is very small, I would prefer a minimalistic, but surprisingly powerful tool.

Long answer

During my investigation of memory leak problems, I used Microsoft Windbg , Microsoft Application Verifier , and I carefully evaluated the Red Gate ANTS Performance Profiler (which I recommend buying, and I personally have seen recommended for purchase by various developers in many different teams), DotTrace and .NET Profiler .

There is some value for getting and learning how to use one or more of these tools, possibly then installed in a virtual development environment hosted on some virtual machine, united between the developers of the team.

If you value both of these tools, a big selling point for me will be the opportunity to explore memory dumps made with Windbg, since they are most easily accessible even from customers.

+2
source

Use a memory profiler - they can help find such leaks, for example:

+2
source
0
source

For the simplest tests, you can use sysinternals procexp.exe to check if you really have a memory leak problem. A lot of COM code would be thrown out of memory when a null pointer occurs where it was not expected, so the exception code can be misleading.

0
source

Source: https://habr.com/ru/post/898690/


All Articles