The advantages and principles of the garbage collection mechanism, and consider two recycling mechanisms
1, a notable feature of Java is the introduction of garbage collection mechanism, so that the C + + Programmer's most headache memory management problem solved, it makes the Java administrator in writing programs without the need to consider memory management , because of the garbage collection mechanism;
2. There is no longer a "scope" concept in Java objects, only references to objects are scoped.
3, garbage collection mechanism can effectively prevent memory leaks , effective use of memory can be used.
4. The garbage collector is usually run as a separate low-level thread , and in unpredictable cases the dead or unused objects in the storage heap are purged and recycled, and the programmer cannot call the garbage collector in real time
Garbage collection of an object or all objects.
5, recovery mechanism has generational replication garbage collection and tag garbage collection , incremental garbage collection .
The advantages and principles of the garbage collection mechanism, and consider two recycling mechanisms