Java Reference
In-Depth Information
Figure 7-3. Histogram view in Memory Analyzer
The histogram aggregates objects of the same type, and in this example it is much more ap-
parent that the 1.4 GB of memory retained by the seven million TreeMap$Entry objects is
the key here. Even without knowing what is going on in the program, it is straightforward
enough to use the Memory Analyzer's facility to trace those objects to see what is holding
onto them.
Heap analysis tools provide a way to find the GC roots of a particular object (or set of ob-
jects in this case)—though jumping directly to the GC roots isn't necessarily helpful. The GC
roots are the system objects that hold some static, global reference that (through a long chain
of other objects) refers to the object in question. Typically these come from the static vari-
ables of a class loaded on the system or bootstrap classpath. This includes the Thread class
and all active threads; threads retain objects either through their thread-local variables or
through references via their target Runnable object (or, in the case of a subclass of the
Thread class, any other references the subclass has).
Search WWH ::

Custom Search