JVM garbage collection methods

How to tell if an object is still alive?

1. Reference counting

There is a disadvantage that it cannot solve the circular dependency problem

2. Accessibility Analysis

Commonly used as the root is mainly in the global reference and execution context

Referenced objects in the virtual machine stack

The object referenced by the constant in the method area

The object referenced by the static variable in the method area

 

Commonly used garbage collection methods

1. Mark Clear

2. Mark finishing

3. Replication algorithm

4. Generational algorithm

The generational algorithm is mainly aimed at heap partitioning. The new generation adopts the replication algorithm, and the old generation adopts the mark sorting algorithm.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325393933&siteId=291194637