Java technology provides a system-level thread, the garbage collector thread (low thread priority), the garbage collection thread execution in a Java program is automatic, cannot be enforced, you can call JAVA.LANG.SYSTEM.GC () manually, notify the JVM GC (garbage Collection), after the JVM accepts this message, it does not immediately do garbage collection, but only a few garbage collection algorithms are weighted, so that garbage collection operations are prone to occur, or early.
GC is performed when Java memory is low, and GC is performed when the virtual machine is idle.
Once the GC is ready to release the storage space occupied by the object, it first calls the Finalize () method to perform some necessary cleanup work. The memory space occupied by this object is only really released until the next garbage collection action.
Finalize () is used for objects, but before the object memory is freed, but the Finalize method of the object class performs a non-specific operation; It performs only a few general returns. Subclasses of Object can override this definition.
Java Garbage Collection Preliminary understanding