Hitachi

uCosminexus Application Server Expansion Guide


7.6.5 Moving the objects from the Java heap to the Explicit memory block based on a reference relation

When objects move from the Java heap to the Explicit memory block, the objects in the Java heap that are being referenced from objects in the Explicit memory block automatically move to the Explicit memory block. Therefore, you need not set the movement from the Java heap to the Explicit memory block for the objects that have relationship with the moving objects. However, if you specify the -XX:+ExplicitMemoryUseExcludeClass option, objects of the classes that are coded in the configuration file for Explicit Memory Management functionality application exclusion do not move to the Explicit memory blocks.

Note that the Explicit memory blocks, which are created by the automatic placement functionality, are targeted for movement of objects based on a reference relationship from the Java heap to the Explicit memory block. The Explicit memory blocks created by the Explicit Management Heap API are not targeted.

Reference note

Take caution if the following phenomena occur after many objects are moved to the Explicit heap when Full GC occurs. In such a case, consider taking measures to prevent objects subject to automatic movement based on reference relations from moving to the Explicit heap.

  • The processing of automatic release of the Explicit memory blocks takes time

  • Small amount of Tenured area is used

Use the following functionalities for not moving the objects to the Explicit memory block:

  1. Functionality for controlling object movement to the Explicit memory block

  2. Functionality for specifying classes to be excluded from an application of the Explicit Memory Management functionality

The first functionality prevents objects from moving to the Explicit heap when Full GC occurs. This functionality can reduce the time of automatic release of Explicit memory blocks. The second functionality prevents objects of the classes specified in a configuration file from moving to the Explicit heap when copy GC occurs. This functionality can reduce the number of objects that move to the Explicit heap, although it depends on the classes you specify. If you use the second functionality, the first functionality is also enabled. Use the second functionality when a large number of objects are to be moved to the Explicit heap and the processing of automatic release of Explicit memory blocks takes time even if you use the first functionality.

Organization of this subsection

(1) Execution timing

This processing is performed when copy GC or Full GC occurs.

(2) Executed details

After copy GC or Full GC processing ends, the Java VM checks for any Explicit memory blocks for which no reservation for release is made. The Java VM examines the reference relationship from the objects that are the basis of investigation, and continues the investigation until there are no more references. The areas other than the Java heap are not targeted for the investigation of a reference relationship. The objects referenced from the Explicit memory block are targeted for movement.

Figures 7-10 and 7-11 describe the flow of the movement of objects in accordance with these rules with examples. Specifying 0 in the -XX:ExplicitMemoryFullGCPolicy option is a prerequisite for the flow of the movement of objects described here.

Figure 7‒10: Objects that move on the basis of a reference relationship (Example 1)

[Figure]

The objects in the figure move in the following sequence:

  1. Object 1 is being referenced from an object in the Explicit memory block 1. Therefore, the object 1 moves to the Explicit block 1.

  2. Object 9 also moves to the Explicit memory block 1 because it is being referenced from the object 1.

  3. In the same way as in points 1 and 2, the object 4, object 10, and object 11 move to the Explicit memory block 2.

  4. Object 6 is being referenced from an object in the Explicit memory block 2. However, it is not an object in the Java heap and hence it does not move.

  5. In the same way as in point 4, the object 12 also does not move.

    Figure 7‒11: Objects that move on the basis of a reference relationship (Example 2)

    [Figure]

The objects in the figure move in the following sequence:

  1. Object 13 is in the Java heap and can be accessed from an object in the Explicit memory block 2. However, it does not move because the investigation terminates at object 12.

  2. Like object 13, the object 15 is referenced from the Metaspace area. However, in addition to the reference, the object can be accessed from an object in the Explicit memory block 2 without involving the Metaspace area or any other Explicit memory block. Therefore, it moves to the Explicit block 2.

  3. Although the object 5 is being referenced from the Explicit memory block 1 as well as the Explicit memory block 2, it moves to the Explicit memory block 1.

    Note that the object 5 is being referenced from the Explicit memory block 1 as well as the Explicit memory block 2. In such cases, although it moves to either the Explicit memory block 1 or 2, it is not defined to which Explicit memory block it will move to.

In the case of following conditions, operation will be different than described in the example.