JavaVM judges when to recycle the Accessibility analysis algorithm used by the object instance, instead of referencing the counting algorithm, javavm instance
I have been developing java for several years. Today I know the java memory Reclaim Algorithm.
The Java Virtual Machine determines whether an object instance can be recycled, rather than referencing the counting algorithm.
Because the reference counting algorithm is difficult to solve the problem that objects directly reference each other cyclically.
Therefore, java C # uses accessibility analysis to determine whether objects can be recycled.
The basic idea of this algorithm is to use a series of objects called "GC Root" as the starting point. From these nodes, you can start to search for elements and find the paths that have passed is called the application chain, when an object is connected to GC Roots without any reference chain. It proves that this object is unavailable and can be recycled. Objects such as object5, object6, and object7 are related to each other, but they can be achieved without GC roots. So they can be recycled.