Live Bytes vs Total Bytes in Graph

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
jeffwalsh
Posts: 2
Joined: Tue May 15, 2018 7:43 pm

Live Bytes vs Total Bytes in Graph

Post by jeffwalsh » Tue May 15, 2018 7:47 pm

How can the Live Bytes be higher than the total bytes. Is this a bug?
See attachment
Attachments
Live vs Total Bytes.png
Real time graph

Andreas Suurkuusk
Posts: 1005
Joined: Wed Mar 02, 2005 7:53 pm

Re: Live Bytes vs Total Bytes in Graph

Post by Andreas Suurkuusk » Thu May 17, 2018 1:23 pm

It's not a bug. It is caused by an optimization in the profiler and the way live bytes data is presented in the real-time view. Collecting information about live instances is very time-consuming. The profiler has to analyse the full managed heap in order to determine which instances are actually reachable from a root. This is the same analysis that the runtime has to perform when doing a full gen #2 garbage collect. And the garbage collector would become very slow if only full gen #2 GCs could be performed.

To prevent very bad performance when collecting real-time data, the profiler will only spend a small amount of time to make a full heap analysis. I don't remember the exact numbers, but I think it's something like 10% of the time. So if it takes 0.1 seconds to do a full heap analysis, it will only be done once per second. Each time a full analysis is performed, the result will be presented with a marker in the real-time view. Between marker it will connect a horizontal line, to make it easier to view the information (see screenshot).
LiveInstancesConnect.png
It is possible to hide the connecting line by using the "Connect GC data" button (see screenshot).
LiveInstancesNoConnect.png
So as long as the marker is equal to or lower that the total bytes count, there's most likely no bug.
Best regards,

Andreas Suurkuusk
SciTech Software AB

jeffwalsh
Posts: 2
Joined: Tue May 15, 2018 7:43 pm

Re: Live Bytes vs Total Bytes in Graph

Post by jeffwalsh » Thu May 17, 2018 2:38 pm

Great explanation. Thanks for clarifying.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests