Which objects can be used as GC root

1. Objects referenced in the virtual machine stack:

  • For example: the parameters and local variables used by the method called by each thread

2. Objects referenced by JNI (usually called local methods) in the local method stack
3. Objects referenced statically by the class in the method area

  • The reference type static variable of the java class
    The object referenced by the constant in the method area
  • Such as the reference in the string constant pool (StringTable)

Guess you like

Origin blog.csdn.net/u014496893/article/details/114780838