Hitachi

uCosminexus Application Server System Design Guide


7.15.6 How regions are used

When an object is created, the JavaVM initially stores it in an Eden region. If the size of the object exceeds half the region size, it is considered a large object# and is allocated to multiple contiguous regions. These multiple contiguous regions are taken from the Free area and allocated to the Humongous area. Because only Full GC and Concurrent Cleanup collect objects from the Humongous area, G1 GC is poorly suited to applications that generate many large objects. For details, see 7.16.3(1) Concept of suppressing Full GC.

The size of a single region is determined as a proportion of the initial size of the Java heap area at startup, and is a fixed size once started. The minimum size of one region is 1 MB, and the maximum size is 32 MB.

#

Here, a large object is an object with a large number of instance fields or an object with a long array. When the region size is 1 MB, a large object is any object larger than 512 KB. Examples of that will qualify as large objects include an object with approximately 130,000 int instance fields, and an object containing a byte array with approximately 500,000 elements.

The following shows how regions are used in terms of the lifecycle from usage to collection.

Figure 7‒24: How regions are used

[Figure]

The preceding figure shows how regions are used. The following explains the processing illustrated by steps 1. to 4. in the figure in detail.

  1. When an object is created

    When an object is created, it is initially stored in the Eden region. When creating a large object, the Free region is allocated to the Humongous region and the object is stored in the Humongous region. If there is no free space in the Eden region, the object is stored in a new Eden region. If there is no free space in the Humongous region, an additional region is allocated from the Free region to the Humongous region and the object is stored.

  2. Selection processing during GC

    When the requirements for GC are met, the JavaVM selects the regions to subject to GC based on the criteria of the GC method being used.

  3. Evacuation during GC

    In-use objects in regions subject to collection are copied to other regions in a process called evacuation. Because regions that have been evacuated will only contain used objects and objects that have been copied and are no longer needed, collection takes place at the region level.

  4. After GC

    The collected regions are designated as Free regions and re-used.