Retained bytes for an instance


When looking at a certain instance, the sum of all its referenced instances' retained bytes is far from the retained bytes of the owning instance. Don't understand where the "missing bytes" comes from.

A (retained bytes: 100)
--reference ->
   B (retained bytes: 10)
   C (retained bytes: 10)

the "missing" 80 bytes A reference above, where do they come from?

1 comment


Retained bytes column shows the overall size in bytes of all objects exclusively retained by a certain instance. You can click "Show objects retained by this instance" button to open subset with retained objects of current instance:

"Outgoing references" view shows the detailed information of a particular instance, like the list of objects referenced from the instance, instance fields including their values, and other. There are other object instances which have other exclusively retained objects. Thus, "Retained bytes" values aren't linked to each other on this view and can be less or greater then sum of retained values for child instances.

For example, let's look at the case when the amount is less. The case when the amount is greater is absolutely similar.

You can see that 208512 bytes in 1629 objects of JetBrains.ReSharper.Psi.Impl.reflection2.elements.Compiled.Class exclusively retained by System.Collections.Generic.HashSet+Slot<JetBrains.Rd.Base.RdExtBase>[17]:

One of retention paths includes .HashSet+Slot[].value-> JetBrains.Rider.Model.RunnableProjectsModel. But this branch is in parallel section, so RunnableProjectsModel doesn't retain "Class" exclusively.

If you open this RunnableProjectsModel and mark the instance, you'll see that it's the one of the nodes from Outgoing References view if HashSet+Slot<JetBrains.Rd.Base.RdExtBase>[17] instance:


Retained size of JetBrains.Rider.Model.RunnableProjectsModel is really small because it doesn't retain a lot of objects exclusively:





Please sign in to leave a comment.