Page 1 of 1

.Net Memory Profiler versus Windows Resource Monitor

Posted: Wed Oct 22, 2014 7:48 pm
by patgerstle
When I run the .Net Memory Profiler on a running Windows service looking for memory leaks, I see New Live Bytes increasing at maybe several hundred an hour with Live Bytes at about 106,000.

When I watch the service in Windows Resource Monitor, I see the Commit (KB) at 84,500 and steadily increasing at about 4 MB an hour.

Makes no sense to me - Are these things related at all? Or I am way off base as to what I am looking at?

Thanks,
Pat

Re: .Net Memory Profiler versus Windows Resource Monitor

Posted: Thu Oct 23, 2014 3:53 pm
by Andreas Suurkuusk
The Commit memory presented by the Windows Resource Monitor should be compared to the "Private committed" memory under the "Native memory" view of the profiler. The managed heaps are a part of this memory, but this memory is also used for unmanaged memory resources, such as memory allocated using HeapAlloc and VirtualAlloc.

In your case it seems like you might have an unmanaged memory leak. To get more information about the unmanaged memory usage you can use the unmanaged resources tracker. To use the resources tracker you need to start your service using the profiler (i.e. you cannot attach to the process). Use the command "Profile Windows service", click "Next" a few times and enable the unmanaged resources tracker. The first time you profile a process with the resources tracker enabled, symbol files need to be loaded, which can cause the profiled process to run very slowly. This will be faster on subsequent runs.

Hopefully the information presented by the resources tracker will help you locate the memory problem.