Garbage collection mechanism
The Java death garbage collection mechanism is one of the important functions of the Java language. When a program creates objects, arrays, and other reference type objects, the system automatically allocates a chunk of memory in the memory area, where the object is stored in the memory area, and when the memory is no longer referenced by any variables, the memory becomes garbage and waits for the garbage collection mechanism to be recycled.
Characteristics of garbage collection mechanism
1. The garbage collection mechanism is only responsible for reclaiming objects in heap memory and does not reclaim any physical resources (such as database connections, network connections, IO streams, and so on).
2. The program does not accurately control the operation of garbage collection, garbage collection will be appropriate when the time. When the object loses its reference permanently, the system will recycle the tower at the appropriate time.
Java basic knowledge Summary of garbage collection mechanism