Java's GC is typically done on the JVM's heap, where a large number of object instances are stored in the Java heap, so JAVAGC is also called a GC heap.
Java divides the memory divisions into:
New Generation (young Generation/new)
Eden Space
From Survivor/survivor 0
to Survivor/survivor 1
The old age (tenured generation/old)
Permanent generation (generally referred to as the method area and constant pool, in general, the permanent generation in the virtual runtime can be determined size, but some frameworks may dynamically generate class information will lead to permanent generation more and more large)
The new generation is divided because the GC algorithm used in the Cenozoic is the replication collection algorithm. This algorithm is more efficient, while GC is mainly occurring in the new generation where objects often die out, so the new generation is suitable for using this replication collection algorithm. Since there is a hypothesis that most of the objects occupied by a new generation of GC (Minor GC) will be recycled, the space for the remaining objects that are still alive after the GC is placed is relatively small. This retained space is Survivor Space:from Survivor or to Survivor. The two survivor spaces are the same size. For example, the Cenozoic size is 10M (xmn10m), so by default (-xx:survivorratio=8), Eden Space is 8m,from and to are 1M.
The new generation is divided because the GC algorithm used in the Cenozoic is the replication collection algorithm. This algorithm is more efficient, while GC is mainly occurring in the new generation where objects often die out, so the new generation is suitable for using this replication collection algorithm. Since there is a hypothesis that most of the objects occupied by a new generation of GC (Minor GC) will be recycled, the space for the remaining objects that are still alive after the GC is placed is relatively small. This retained space is Survivor Space:from Survivor or to Survivor. The two survivor spaces are the same size. For example, the Cenozoic size is 10M (xmn10m), so by default (-xx:survivorratio=8), Eden Space is 8m,from and to are 1M.
When you start a new object, it is allocated on Eden space, and if Eden space is not enough, you will do a minor GC. After the GC is Minor, the objects that are still alive in Eden and from are copied to the to space. If the to space cannot accommodate an object that is alive after minor GC, then the object is promote to the old age space. The objects that are copied from the Eden space to the to space have age = 1. If the object of this age=1 is still alive after the next minor GC, it will also be copied to another survivor space (if the From and to are fixed, that is, back from the to space), and its age=2. So again, if age is greater than a certain threshold (-xx:maxtenuringthreshold=n), that object can also be promote to the old years.
If the sum of the same age (for example, Age=5) object in the survivor space is greater than or equal to half of the survivor space, then the Age>=5 object can be minor directly to the old age after the next promote GC, rather than waiting for the age to grow to a threshold.
When doing minor GC, only the new generation is recycled, will not be recycled in the old age. Even if the object of the old age is not indexed, it will still survive until the next full GC.
Learn more about JAVAGC wit can be consulted article: http://blog.csdn.net/initphp/article/details/30487407
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
JAVAGC Garbage Disposal