|
With the heap walker, you can find memory leaks, look at single instances and flexibly select
and analyze objects in several steps.
Important notions are
-
the current snapshot
The heap walker operates on a static snapshot of the heap which is taken by
-
clicking on the corresponding
toolbar button
-
using the "Take heap snapshot for selection" action in the
memory views.
If a snapshot has already been taken, it will be discarded after confirmation.
If the current session is
detached, it is not possible to take a new snapshot,
Taking a snapshot may take from a few seconds to a few minutes depending on the heap size of the profiled
application.
A bookmark will be added when a heap snapshot
is taken manually.
Note that you can also use a
trigger and the
"Trigger heap dump" action
to take a snapshot. This is especially useful for offline profiling.
-
the initial object set
After a snapshot has been fully prepared, you are taken to the
the classes view and all objects
in the snapshot are displayed. You can return to this view at any later point by
- choosing View->Heap walker start view
from JProfiler's main menu
- clicking on the the corresponding
toolbar button
-
the current object set
After each selection step a new object set is created which then becomes the current object set.
Starting with the initial object set, you add selection steps and change the current object set
to drill down toward your objective. The contents of the current object set (any number
of instances of classes and arrays) are described in the title area of the heap walker.
You can calculate the retained size and the deep size of the entire object set by clicking
on the "Calculate retained and deep sizes" hyperlink in the title area. Once the calculation
is finished, the hyperlink is replaced with the results.
The history of your selection steps can be shown at the bottom by clicking on the the corresponding
toolbar button
-
the view on the current object set
All views share the same
basic layout.
There are 5 top-level views which show information on the current object set:
In addition there are two more views:
-
the inspections view
which shows inspection that operate on the current object set
-
the graph which does not
show data from the current object set. You can add objects from the reference
and biggest objects views that are not cleared when you add selection steps.
The view is chosen either
-
the three types of size measurements
The title area of the heap walker displays several sizes for single objects or object sets. All sizes
include only the object data, they do not include internal JVM structures for classes, nor do they
include class data or local variables.
-
shallow size
The shallow size does not include the size of referenced arrays and
instances but only the size of the corresponding pointers. Shallow sizes are
trivially available for all objects and object sets and are displayed in all views.
-
retained size
The retained size is calculated as the shallow size plus total size of all objects
that would be garbage collected if the current object or object set were removed.
This size tells you how much memory is really behind an object or object set.
Retained size calculation is done for all objects when the heap dump is processed.
Retained sizes are shown for single instances in several views.
-
deep size
The deep size is calculated as the shallow size plus total size of all referenced
objects. In extreme cases, this value may be a significant
percentage of the entire heap. Deep size calculation is only available for the current object set.
|