MemProfiler vs. perfmon inconsistency

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.

Moderator: SciTech Software

MemProfiler vs. perfmon inconsistency

Postby sthiers » Thu Oct 01, 2009 9:14 am

Hello,

I would like to understand an inconsitency between perfmon results and MemProfiler's ones:

When I launch our application and reach a well identified state,
perfmon counters show
473 Mo of private bytes (in "Process" performance object)
79 Mo of "Bytes in all heaps" (in .NET CLR Memory performance object)

When the same application is run under MemProfiler 3.0.142.0 and reach the same identified state, MemoProfiler shows in types/resources view,
column "live instance sizes":
129 Mo of unmanaged resources
41 Mo Of .NET live instance sizes

I expected these numbers to fit with perfmon's ones, but they obviously do not. More precisely, I expected to have 129 + 41 = 170 Mo of private bytes, but I get 303 Mo more !

What's wrong?

Thank you
Stéphane

PS:
sthiers
 
Posts: 8
Joined: Thu Oct 02, 2008 7:44 am

Postby Andreas Suurkuusk » Thu Oct 01, 2009 2:41 pm

The numbers presented under the Types/Resources view and the numbers presented by the performance counters cannot be compared directly. Native memory (such as VirtualAlloced memory) is only presented in the resources list as long as it has not been sub-allocated. For instance, if a small HeapAlloc instance is sub-allocated from a large VirtualMemory instance, then only the small HeapAlloc instance will be included in the snapshots view. This will cause the number of bytes presented in the Types/Resources view to be smaller than the number of bytes presented by the Process performance counters. In the native memory view, all memory is presented, so there the numbers matches the numbers presented by the performance counters. The private bytes node in the native memory view should be the same as the Private bytes performance counter (except that memory used by profiler itself is excluded in the native memory view).

The .NET performance counters reflect the numbers of bytes allocated for all GC heaps, it doesn't consider whether there's an actual managed instance using the memory. In the Type/Resources view, you will only see the memory used by "Live instances" (i.e. instances that are reachable from a root). Thus the memory usage presented will be lower than the perfomance counter value. Again, the native memory view should present numbers that are closer to the performance counter numbers.

To get more detailed information in the Native memory view, I recommend that you download the latest release of .NET Memory Profiler from http://memprofiler.com/download.aspx.
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 980
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden


Return to Using .NET Memory Profiler

Who is online

Users browsing this forum: No registered users and 2 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron