Hitachi

uCosminexus Application Server System Design Guide


7.15.3 GC mechanism that targets the New area

The JavaVM divides the memory space of the New area that is subject to young GC or mixed GC into the Eden area and the Survivor area for management purposes. The survivor area is further divided into a From space and a To space. The From space and the To space have the same memory size.

The following figure shows the configuration of the New area.

Figure 7‒18: Configuraton of New area

[Figure]

The Eden area is the area in which objects created by the new operator are first stored. Memory is allocated from the Eden area when a program executes the new operator.

When the Eden area becomes full, young GC or mixed GC is executed and the following processing takes place:

  1. The in-use Java objects in the Eden area and in the From space of the Survivor area are copied to the To space of the Survivor area. The Java objects that are not in use are destroyed.

  2. The designations of the To space and From space of the Survivor area are swapped.

As a result, the Eden area and the To space become empty, and all in-use objects are now in the From space.

The following figure shows the movement of objects when young GC or mixed GC occurs.

Figure 7‒19: Movement of objects when copy GC is executed

[Figure]

In this manner, objects that are in use move back and forth between the From space and the To space each time young GC or mixed GC occurs. However, the processing associated with moving objects with a long lifespan back and forth comes with several issues, including the load it imposes on the system. To prevent these issues, you can set a threshold value that governs how many times a Java object can be moved between the From and To spaces, and move objects whose age reaches this threshold to the Tenured area.