Garbage Collection Internal Working
In Java Garbage Collector was created based on the following two hypotheses. (It is more correct to call them suppositions or preconditions, rather than hypotheses.)
- Most objects soon become unreachable.
- References from old objects to young objects only exist in small numbers.
These observations come together in the Weak Generational Hypothesis. Based on this hypothesis, the memory inside the VM is divided into what is called the Young Generation and the Old Generation. The latter is sometimes also called Tenured.
Since the GC algorithms are optimized for objects which either ‘die young’ or ‘are likely to live forever’, the JVM behaves rather poorly with objects with ‘medium’ life expectancy.
Memory Pools
The following division of memory pools within the heap should be familiar. What is not so commonly understood is how Garbage Collection performs its duties within the different memory pools. Notice that in different GC algorithms some implementation details might vary but, again, the concepts in this chapter remain effectively the same.
Eden
https://plumbr.eu/handbook/garbage-collection-in-java
Comments
Post a Comment