PhpStorm 2018.1 Help

Keymap:

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 V8 Profiling - Analyze V8 Heap Snapshot on the main menu and select the relevant .snapshot file. PhpStorm 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.

Containment

The Containment tab shows the objects in your 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, PhpStorm shows the percentage of memory the object occupies.

Biggest Objects

The Biggest Objects 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.

Summary

The Summary 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.

Details Pane

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 PhpStorm 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 checkbox to search in all the scopes. When this checkbox is selected, all the other search types are disabled.

Class Names: select this checkbox to search among functions-constructors.

Text Strings: select this checkbox to perform a textual search in the contents of the objects.

Snapshot Object IDs: select this checkbox 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.

Marks: select this checkbox 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.

Toolbar

The toolbar is common for all tabs and most of the toolbar buttons are available in all tabs.

Item

Description

Available in

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.

Class Names: select this checkbox to search among functions-constructors.

Text Strings: select this checkbox to perform a textual search in the contents of the objects.

Snapshot Object IDs: select this checkbox 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.

Marks: select this checkbox to search among the labels you set to objects manually by clicking on the toolbar of the Containment tab.

Containment tab

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, Summary tab, Occurrences view

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

Context Menu of an Object

Item

Description

Mark

Choose this option to set a label to the selected object. This helps you differentiate objects and move from one to another without losing the context.

Navigate in Main Tree

Choose this option 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.

Jump to Source

Choose this option to navigate to the function or variable that corresponds to the selected object.