Debugging a huge memory leak in the application

My application just leaked 1.5 GB of memory. I think since I don’t have a ton of data available to me, I guess it leaked into memory, but it can also just hold onto it.

I am currently using perfmon to collect as much information as possible in order to try to understand what might cause the problem. I don’t have a lot of potential customers at the moment, and I was hoping to get more hints from the people here.

  • The first thing I can say is that I do not implement IDisposable in any of my classes. However, I know that I do not call Dispose on any of the GUI elements, such as SolidColorBrush. Since my application does not use graphics intensively, I believe that this can not cause problems. However, I will add the necessary calls.

  • I do not know if I use any other classes in an environment that implements IDisposable. I read a post here on SO about FxCop. I installed and used it to analyze my assembly, but it seems to only check the correct implementation of IDisposable for my own classes. Is there another tool that can tell me ALL classes that implement IDisposable?

  • I am currently using WF in my application, and WF is constantly starting and ending. Perfmon shows that WF ends correctly, and I use the keyword "using", which, as I understand it, deals with the correct deletion for me.

  • Is there an easy way to tell if a memory leak is unmanaged or managed code?

  • At the time I got the OOM exception, the application used 77k + manipulators.

Any advice on how to proceed next will be greatly appreciated. I plan to launch the application again and monitor performance counters and possibly make certain calls. I can also run the simulation for comparison, since in this mode it will not be called in my C DLL.

+2
5

, , ...

, . .

\PrivateBytes process\Handle Count \NonPagedPool

.NET CLR *

, .NET CLR Memory\BytesInAllHeaps, . : CLR Profiler , , windbg.exe , dll sos extension .

IF , .NET CLR Memory *, . windbg.exe .

HandleCount, NonPagedPool, - . , - processmon.exe sysinternals, , .

, .

+2
0

Directly answering your question, but I always use the Process Explorer , which shows the process Virtual Size, Working Set, Gen 0.1 and 2 Collections and private bytes (associated with unmanaged memory). Basically, it's just a nice interface for a regular Windows task manager and performance counters. May help you observe the behavior associated with the memory of your application.

0
source

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


All Articles