Hitachi

uCosminexus Application Server System Design Guide


7.15.5 Relationship between memory space and region

G1 GC divides the Java heap area into a New area which stores objects with a short lifespan, and a Tenured area which stores objects with a long lifespan. The New area is further divided into an Eden area for objects that were just created by the new operator, and a Survivor area for objects that have survived GC at least once. Objects that have undergone GC in the New area a certain number of times are determined to have a long lifespan and transferred to the Tenured area.

The following figure shows an overview of the memory spaces managed by G1 GC while an application is running. The Eden area, Survivor area, Tenured area, and Free area are collectively called the Java heap area.

Figure 7‒22: Configuration of memory spaces managed by G1 GC during application execution

[Figure]

G1 GC does not allocate a Tenured area from the start. When the time comes to move an object to the Tenured area, G1 GC moves the object after allocating a region of the Free area to the Tenured area. G1 GC also expands or shrinks the New area after GC (hereinafter called resizing). When resizing entails expanding the New area, G1 GC allocates a region of the Free area to the New area. When resizing entails shrinking the New area, G1 GC recovers a region of the New area and allocates it to the Free area. When an object is created that is large in size, that object is stored in the Humongous area.

The following explains how each area is used:

Figure 7-22 shows the areas of the Java heap area to be contiguous, but the areas are not necessarily contiguous in practice. G1 GC manages the Java heap area as blocks called regions, which are allocated in a distributed way as shown in the following figure.

Figure 7‒23: Structure of memory space in practice

[Figure]

Each region is represented by the name of the area followed by the word region. For example, a region of the Eden area is called an Eden region, and a region of the New area is called a New region.