V8 Heap Tool Window
The tool window opens when you take a snapshot and choose to open it. The tool window shows the collected profiling data. If the window is already opened and shows the profiling data for another session, a new tab is added. Tabs that were opened automatically are named after the run configurations that control execution of the applications and collecting the profiling data.
If you want to open and analyze some previously saved mempry profiling data, choose on the main menu
and select the relevant
.snapshot file. IntelliJ IDEA creates a separate tab with the name of the selected file.
The tool window has three tabs that present the collected information from difference point of views.
On this page:
The tab shows the objects in you application grouped under several top-level entries: DOMWindow objects, Native browser objects, and GC Roots, which are roots the Garbage Collector actually uses. See Containment View for details.
For each object, the tab shows its distance from the GC root, that is the shortest simple path of nodes between the object and the GC root, the shallow size of the object, and the retained size of the object. Besides the absolute values of the object's size, IntelliJ IDEA shows the percentage of memory the object occupies.
The tab shows the most memory-consuming objects sorted by their retained sizes. In this tab, you can spot memory leaks provoked by accumulating data in some global object.
The tab shows the objects in your application grouped by their types. The tab shows the number of objects of each type, their size, and the percentage of memory that they occupy. This information may be a clue to the memory state.
Each tab has a Details pane, which shows the path to the currently selected object from GC roots and the list of object’s retainers, that is, the objects that keep links to the selected object. Every heap snapshot has many “back” references and loops, so there are always many retainers for each object.
Navigating through a Snapshot
- To help differentiate objects and move from one to another without losing the context, mark objects with text labels. To set a label to an object, select the object of interest and click on the toolbar or choose Mark on the context menu of the selection. Then type the label to mark the object with in the dialog box that opens.
To navigate to the function or variable that corresponds to an object, select the object of interest and click on the toolbar
or choose Edit Source on the context menu of the selection. If the button and the menu option are disabled, this means that IntelliJ IDEA has not found a function
or a variable that corresponds to the selected object.
If several functions or variables are found, they are shown in a pop-up suggestion list.
- To jump from an object in the Biggest Objects or Summary tab or Occurrences view to the same object in the Containment tab, select the object in question in the Biggest Objects or Summary tab and click on the toolbar or choose Navigate in Main Tree on the context menu of the selection. This helps you investigate the object from the containment point of view and concentrate on the links between objects.
To search through a snapshot:
- In the Containment tab, click on the toolbar.
In the V8 Heap Search Dialog that opens, specify the search pattern and the scope to search in. The available scopes are:
- Everywhere: select this check box to search in all the scopes. When this check box is selected, all the other search types are disabled.
Link Names: select this check box to search among the object names that V8 creates
when calling the C++ runtime,
In the V8 Heap Tool Window, link names are marked with the
- Class Names: select this check box to search among functions-constructors.
- Text Strings: select this check box to perform a textual search in the contents of the objects.
Snapshot Object IDs: select this check box to search among the unique identifiers of objects.
V8 assigns such a unique identifier in the format to each object when the object is created and
preserves it until the object is destroyed. This means that you can find and compare the same objects in several snapshots taken
within the same session.
In the V8 Heap Tool Window, object IDs are marked with the
- Marks: select this check box to search among the labels you set to objects manually by clicking on the toolbar of the Containment tab.
The search results are displayed in the Details pane, in a separate Occurrences of '<search pattern>' view. To have the search results shown grouped by the search scopes you specified, press the Group by Type toggle button on the toolbar.
When you open the dialog box next time, it will show the settings from the previous search.
The toolbar is common for all tabs and most of the toolbar buttons are available in all tabs.
|Click this button to set a label to the selected object. This helps you differentiate objects and move from one to another without losing the context.||Containment tab, Biggest Objects tab, Summary tab, Details pane, Occurrences view|
Click this button to find a function in a snapshot: in the V8 Heap Search Dialog that opens, specify the search pattern and the scope to search in.
The available scopes are:
|Click this button to jump from an object in the Biggest Objects or Summary tab or Occurrences view to the same object in the Containment tab. This helps you investigate the object from the containment point of view and concentrate on the links between objects.||
Biggest Objects tab,
|Click this button to navigate to the function or variable that corresponds to the selected object.||Containment tab, Occurrences view|
|Press this toggle button to have the search results shown grouped by the search scopes you specified.||Occurrences view|
|Click this button to open the reference page for the tool window.||All|
|Click this button to close the tool window.||All|