GC (Garbage Collection) is the garbage collection mechanism in java. It is one of the main differences between Java and C/C. When using JAVA, there is generally no need to specially write memory recycling. and garbage cleaning code. This is because in the Java virtual machine, there is an automatic memory management and garbage cleaning mechanism.
The memory size of the computer remains unchanged. When we use an object, such as using the New keyword, an object will be produced in the memory. However, when we use JAVA to develop, when an After the object is used, we do not manually release the memory occupied by that object. In the process of using the program, there are more and more objects. When the memory cannot store so many objects, the computer will crash. For JAVA To solve this problem, we introduced this function, or mechanism, to automatically clear useless objects. This is GC. It has a nice name called garbage collection. In fact, it is used to wipe your butt, so that you can write code with peace of mind. Let’s take care of memory release and object cleaning.
Recommended learning: Java video tutorial
The above is the detailed content of What does GC mean in java?. For more information, please follow other related articles on the PHP Chinese website!