Page 1 of 1

Live Bytes vs Total Bytes in Graph

Posted: Tue May 15, 2018 7:47 pm
by jeffwalsh
How can the Live Bytes be higher than the total bytes. Is this a bug?
See attachment

Re: Live Bytes vs Total Bytes in Graph

Posted: Thu May 17, 2018 1:23 pm
by Andreas Suurkuusk
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.

Re: Live Bytes vs Total Bytes in Graph

Posted: Thu May 17, 2018 2:38 pm
by jeffwalsh
Great explanation. Thanks for clarifying.