IntelliJ IDEA 2017.3 Help

Analyze objects in the JVM heap

IntelliJ IDEA lets you explore objects in the JVM heap during a debug session in the Memory view (to open it, click Restore 'Memory' View debug memory view in the top-right corner of the Debug tool window).

The Memory view shows you the total number of objects in the heap:

debug memory view sample

When you step over the code, the Diff column shows how the number of objects changes between the debugger stops, which helps you see how the code you are stepping affects the heap.

Double-click a class name to view all instances of this class:

debug memory class instances

This dialog lets you filter instances by an evaluated expression, enable tracking of new instances for this class, and perform all debugger operations, such as Inspect, Mark Object, Evaluate Expression, Add to Watches, etc. from the context menu.

When you enable tracking of new instances for a class, the debug memory track new instances icon icon appears next to the corresponding object in the Memory view and, if the number of object changes, the value in the Diff column becomes clickable, which lets you quickly check what the new objects are:

debug memory new instance

To disable tracking of new instances for a class, right-click and deselect the Track New Instances option.

Click the cogwheel blue with arrow icon in the top-right corner to toggle the following viewing options:

  • Show With Instances Only: if selected, only classes that have instances are listed.
  • Show Non-Zero Diff Only: if selected, only objects whose number has changed since the last debugger stop are listed.
  • Show Tracked Classes Only: if selected, only classes for which tracking of new instances is enabled are listed.
  • Enable Tracking With Hidden Memory View: if selected, tracking of new instances for classes will still be enabled, even if the Memory view is closed.
Last modified: 6 March 2018