PhpStorm 2016.3 Help

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.

On this page:

Containment

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, PhpStorm shows the percentage of memory the object occupies.

Biggest Objects

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.

Summary

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.

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 ws_v8_profiling_mark.png 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 edit.png 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 ws_v8_profiling_navigate_in_main_tree.png 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:
    1. In the Containment tab, click find.png on the toolbar.
    2. 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, see http://stackoverflow.com/questions/11202824/what-is-in-javascript.

        In the V8 Heap Tool Window, link names are marked with the % character (%<link name>).

      • 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 @ character (@<object id>).

      • Marks: select this check box to search among the labels you set to objects manually by clicking ws_v8_profiling_mark.png 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.

ItemDescriptionAvailable in
ws_v8_profiling_mark.png 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
find.png 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:
  • 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, see http://stackoverflow.com/questions/11202824/what-is-in-javascript.

    In the V8 Heap Tool Window, link names are marked with the % character (%<link name>).

  • 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 @ character (@<object id>).

  • Marks: select this check box to search among the labels you set to objects manually by clicking ws_v8_profiling_mark.png on the toolbar of the Containment tab.
Containment tab
ws_v8_profiling_navigate_in_main_tree.png 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
edit.png Click this button to navigate to the function or variable that corresponds to the selected object. Containment tab, Occurrences view
ws_v8_profiling_group_by_type.png Press this toggle button to have the search results shown grouped by the search scopes you specified. Occurrences view
help.png Click this button to open the reference page for the tool window. All
close.png Click this button to close the tool window. All

Context Menu of an Object

ItemDescription
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.

See Also

Last modified: 23 March 2017