!! !! !! I made a mistake in some places, so I rewrote the revised version! !! !! Revised edition Introduction to the GC mechanism of JVM
It mentions the GC algorithm and the role of each area in the heap area.
There are various types of GC algorithms themselves. The following two are the most basic.
-Reference Counter --Referenced minute count. Cross-references cannot be erased.
Mark & Sweep is the standard in Java
If the unnecessary area is released repeatedly, the empty area becomes uneven and inflexible. => The processing cost of creating a new object increases.
Therefore, the following algorithms are combined.
** This is why the heap area has a From area and a To area. ** **
--Stop the world to reduce application downtime as much as possible while doing GC --Since the processing load is high when GC is applied to all target memory areas (FullGC), you want to reduce the load of one GC.
Therefore, in order to solve these problems, in the actual JVM, algorithms such as generational GC are combined with the basic algorithm (Mark & Sweep).
** Part of that is that there are New and Old in the heap area of the JVM. This is intended to limit the scope of GC and distribute the load by the generational GC algorithm. ** **
Reference: GC by generation
From the contents so far
--The reason why there are New and Old in the heap area is to limit the area targeted for GC and distribute the processing load. (Does the Eden area in New also exist because you want to remove the newly created object from the GC target and separate it?)
--The reason why From and To are separated in the New and Old areas is to perform copying to prevent fragmentation of the heap area.
Java heap memory management mechanism
An algorithm called Garbage First Garbage Collection is coming ...?
Recommended Posts