Show Recycling garbage analysis?
the traditional c,c++ language requires the programmer to reclaim the allocated memory.
This is done by programmers, which can cause problems, because programmers do not always know when memory should be released, and if some of the allocated memory is not recovered in a timely manner, it can cause the system to slow down, or even program paralysis, which is called a memory leak.
Cons: 1) The program forgets to reclaim useless memory in time, which causes memory leak and reduces system performance.
2) The program incorrectly reclaims memory from the system's core class library , causing the system to crash.
The memory allocations for Java programs are performed automatically by the Java Runtime Environment JRE in the background. The JRE is responsible for reclaiming memory that is no longer used, a mechanism known as the garbage collection mechanism. Programmers cannot precisely control the time and order of garbage collection. The general JRE provides a background thread for detection and control, both when the CPU is idle or when the memory is low.
Garbage collection mechanism for Java programs