IntelliJ IDEA
 
Get IntelliJ IDEA

Analyze objects in the JVM heap

Last modified: 23 October 2024

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

This information is useful for detecting memory leaks and their causes. Sometimes, code examination alone might not provide clues, as some errors are easy to overlook. For example, inner classes may prevent the outer classes from becoming eligible for garbage collection, which may eventually result in an OutOfMemoryError. In such cases, combining the Memory tab with the Show Referring Objects option lets you easily find the leak.

Also, 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.

Memory tab

The Memory tab shows the following information: