Page 1 of 1

Comparing .NET CLR Memory\# Bytes in all Heaps

Posted: Thu Jul 28, 2011 9:53 am
by krishnakumar
Which data in real time tab corresponds to the perfmon counter - .NET CLR Memory\# Bytes in all Heaps?
I profiled a .Net 4.0, WPF GUI application. The perfmon counter (# Bytes in all Heaps) shows 68 MB where as the Live Bytes in memory snapshot shows 46 MB after first iteration.
How do I relate these two information?

Re: Comparing .NET CLR Memory\# Bytes in all Heaps

Posted: Thu Jul 28, 2011 7:54 pm
by Andreas Suurkuusk
There's no number in the real-time plot in .NET Memory Profiler that directly corresponds to the perfmon counter ".NET CLR Memory\# Bytes in all Heaps". I'm not exactly sure what the number represents, but I as far as I remember, it is the total number of bytes committed for the managed heaps. The perfmon number should always be greater than the total bytes number. However, the total bytes number is updated for each managed allocation while the perfmon counter is updated less frequently. After a GC, the runtime might release some unused memory to the OS, but not necessarily all, since it want to keeps some memory for future allocations. So even after a GC, the perfmon counter will be higher than the live bytes and total bytes real-time value.