The counter of the program, the virtual machine stack, the local method stack 3 regions are born with threads, and the stack in the stack executes the stack and stack operations methodically as the method enters and exits.
The method of judging if the object is dead:
First, the reference counting algorithm:
Add a reference counter to the object, and whenever there is a place to reference it, the counter value is incremented by 1, and when the reference fails, the counter value is reduced by 1, and the object with counter 0 at any time is not possible to be used again.
Two, the Accessibility analysis algorithm:
The basic idea is to use a series of objects called "GC Roots" as the starting point, starting from these nodes to search down, the path that the search traversed is called the reference chain (Reference Chain), when an object to the GC Roots no reference chain connected, it proves that this object is not available.
Cond...
Java garbage collector and memory allocation policy