[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.technology.memory-analyzer] Re: Histogram and Dominator_Tree
|
First one is why MAT provides two editors Histogram and Dominator_Tree and
what are they good for?
Both are views on the same base data: the histogram is aggregates data on
class level. So for each class you see the class name, the number of
instances and the shallow size. The last column contains the retained size
- this is the heap that would be freed if all of those objects were
garbage collected. Remember that this number includes also objects that
are referenced from more than one object represented by this row.
The dominator tree on the other hand looks at individual objects. The next
level are the objects that would be garbage collected if the parent node
would have no reference. And that is true for every level. That means if
you pick the top level object (and remove all references to it), then all
objects in the tree below are removed.
Second one is how the retained heap are calculated in two
editors(diagrams)as I found different componets stay on top in these two
diagrams when I try to group them by calss loader or by class , or by
package. It seems to me that the retained size in Dominator_Tree is
calculated by accumulating lagest objects according to their
classifications and for Histogram,I think the calcuation is by other means.
The retained size is always calculated the same way:
(i) remove all references to the object or the set of objects
(ii) form the Garbage collection roots mark all reachable objects
(iii) the retained size is the sum of all objects not marked
The difference can come from this scenario:
A -> B <- C
Object A and C reference B.
The retained size of A does not include B, because B is still alive via C.
The retained size of C does also not include B, because it is still alive
via A
The retained size of A and C contains B, because now it is not reachable
anymore.
Basically, if A and C are of the same class (say java.lang.String) then
the retained size in the String row also contains B.
In the dominator tree, you would find A, B, C on the top level. Of course,
if you group here, then A and C are grouped, but do not include B. Why? To
include B is an expensive operation so it's not easy to do. And often you
don't really need this (margin of error is about 3 to 5 percent).
I hope I was able to shed a little bit of light. :-)