VisualVM memory failure

When using visualVM to detect a memory leak, it allows us to view the instance as described below:

The Instance view displays object instances for the selected class. When you select an instance from the Instance panel, VisualVM displays the fields of this class and references to this class in the respective panels. In the Links panel, you can right-click an item and select Show Nearest GC Root to display the nearest root garbage collection object.

Can someone tell me what is the nearest root garbage collection object and how to use this information to help identify leaks. Thanks!

+3
source share
2 answers

You can find this Sun collection / garbage collection book / section , specifically this section listing GC root as:

  • Temporary variables on the stack (of any thread)
  • Static variables (from any class)
  • Special links from JNI native code
In other words, the roots of the GC are variables that can hold another object from the GCed by virtue of the root containing the reference to it.
+2
source

GC root is a reference contained in a static or local variable. The link contained in the root prohibits the collection of the associated object.

VisualVM " GC root", , , , .

0

Source: https://habr.com/ru/post/1722752/


All Articles