## Heap Walker View Section |

| 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 choosing View->Take heap snapshot from JProfiler's main menu 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 a few seconds depending on the size of the profiled application. A bookmarks 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 also 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 choosing View->Show selection steps from JProfiler's main menu clicking on the the corresponding toolbar button the view on the current object set All views share the same basic layout. There are 6 top-level views, all of which show the current object set: the classes view the allocation view the biggest objects view the reference view the data view the time view The view is chosen either using the view selector at the bottom of the heap walker. or from the view helper dialog that is displayed each time a new object set is created. You can suppress this dialog in the heap walker view settings. the three types of size measurements The title area of the heap walker as well as the reference graph and the data view of the heap walker display 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.

| The history controls of the heap walker in JProfiler's toolbar allow you to go backward and forward in the history of your view changes. View changes where selection steps were performed, as well as those performed through the view selector are recorded in the history.

| Changing the current object set is done by clicking on the [Use selected] buttons in the heap walker views. You first select objects of interest and then use this button to create a new object set that contains only these objects. In many cases you can double click on an item to create a new object set with it.

| The heap walker will be able to display allocation call stack information only for recorded objects. See the memory section overview for further details.