
The Diff column shows if the number of instances has changed.Ī dialog opens that lists all live instances of the selected class. Resume the program execution or step through the code.Ĭollect instances data at the second point. For this, you can collect the information twice and compare it using the built-in Diff feature.Ĭollect instances data at the starting point. Sometimes it is useful to know how many objects have been created since some point. Get the diff between two execution points The name filter will be applied dynamically as you type. Clicking the already selected criterion changes the order (ascending/descending).

To sort the classes, click the corresponding header ( Class, Count, or Diff). The number of corresponding live objects is shown in the Count column. The list of all loaded classes appears on the Memory tab. In the Memory tab, click Load classes (for performance, the Memory tab only collects the data on demand). Stop at a breakpoint or manually suspend the program. Get the information on the number of objects The Memory tab shows the following information:Ĭount: the number of class instances (objects) in the heapĭiff: the difference in the number of instances between two execution points Hide/show Memory tabĬlick in the top-right corner of the Debug tool window, then click Memory. In such cases, combining the Memory tab with the Show Referring Objects option lets you easily find the leak.Īlso, examining the memory usage helps you better understand what is going on under the hood and optimize the program by minimizing the creation of unnecessary objects. For example, inner classes may prevent the outer classes from becoming eligible for garbage collection, which may eventually result in an OutOfMemoryError. Code examination alone might not provide any clues as some errors are easy to overlook. This information is useful for detecting memory leaks and their causes.

IntelliJ IDEA lets you track the instances and analyze the conditions that cause objects to spawn or be retained. When debugging, you can use the Memory tab to view details of all objects in the heap.
