"Unmanaged memory" in the profiler diagram. Is this an indication of a memory leak?

I came across this diagram while profiling memory usage in my application:

enter image description here

As you can see, before the "snapshot 1" line, the unmanaged memory contains about half of the total used memory. Then, after "snapshot 1" and 2min 55s (see graph below), I forced the garbage collection.

As I expected, generation 2 was mostly compiled, but no unmanaged memory was released and now it takes approx. 2/3 of the total used memory.

I have no idea what "unmanaged memory" means in this context. This is a WPF app with some WinForms / GDI + interop. I'm pretty sure everything that needs to be disposed of is located. In addition, there is no explicit platform interaction code. The rest of the managed memory is fine.

Is this an indication of a memory leak?
If so, what is the way to detect memory leak here?
This is important, the profiler I'm using is JetBrains dotMemory.

+3


source to share


1 answer


The "shared used" memory on dotMemory represents this private worker process. This is the memory that the process executable has requested - not necessarily the amount it actually uses. It includes all your DLLs and heaps, but does not include memory mapped files (shared DLLs). Also, there is no way to tell if it belongs to the executable itself or a linked library. It's not just physical memory; they can be swapped out to disk or in the spare page list (i.e. no longer used but not swapped out yet). Thus, unmanaged memory is everything in the private working set, except for the CLR heap-managed. You usually don't have easy ways to change the amount of unmanaged memory for a clean .net process. And this is approximately constant during the execution of the program.



+4


source







All Articles