Reachability analysis algorithm

  Realization of ideas: Object GC Roots "as a starting point, to start the search downward from these nodes, called search path traversed reference chain (Reference Chain), to an object is not connected to any reference GC Roots chain (graph theory the words, is from GC Roots to this object is unreachable), then it proves that this object is not available.

  Pros: can solve the problem of circular references another target.

Target object 5, object 6, object 7 although there are interrelated, but they are not up to the GC Roots, so they will be determined to be recyclable objects.

In the Java language, as an object GC Roots may include the following categories:

  • VM stack objects (local variables table stack frame) referenced.
  • Method static property class object referenced area.
  • Object literal reference methods zone.
  • Native method stacks in the JNI (i.e., the general said method Native) object reference.

Guess you like

Origin www.cnblogs.com/gogogofh/p/11113852.html