uCosminexus Application Server, Expansion Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
8.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
- When a full garbage collection occurs, if the following phenomena occur after a large number of objects are moved to the Explicit heap, examine the operation, which does not let move the objects that are targeted for movement on the basis of a reference relation to the Explicit memory block.
- 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:
- Functionality for controlling object movement to the Explicit memory block
- Functionality for specifying classes to be excluded from an application of the Explicit Memory Management functionality
- The first functionality does not move the objects to the Explicit heap when a full garbage collection occurs. By using this functionality, you can reduce the time required for the processing of automatic release of Explicit memory blocks. The second functionality does not move the objects of the classes specified in the configuration file, to the Explicit heap when a copy garbage collection occurs. You can reduce the number of objects to be moved to the Explicit heap depending on the specified classes. 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
- (2) Executed details
(1) Execution timing
The objects are moved when the copy garbage collection and full garbage collection occurs.
(2) Executed details
After the copy garbage collection or full garbage collection processing is over, investigation is performed to check the existence of the Explicit memory blocks that JavaVM has not reserved for release. Find a reference relationship from the objects that are the basis of investigation and continue the investigation until you are done with all the reference locations. 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.
- When executing a copy garbage collection
If the copy garbage collection is executed, move objects in accordance with the following rules in addition to the rules stated above:
- Move an object when the object in the Explicit memory block that is being referenced, rises.
- Do not target objects for investigation if they are referring to the Perm heap, Explicit heap and the Tenured area.
- Even if an Explicit memory block is reserved for release, consider it as targeted for moving.
This case corresponds to the ones when objects cannot be moved because the area of the Explicit memory block cannot be secured and there is no free space in the movement destination Java heap when the object moves to the Java heap. In such cases, the full garbage collection is executed and a free space is secured in the Java heap. After execution of the full garbage collection, the object is moved to the Java heap.
- When executing a full garbage collection
If a full garbage collection is executed, objects are moved in accordance with the following rules in addition to the rules stated above:
- If you specify 1 in the -XX:ExplicitMemoryFullGCPolicy option, the objects targeted for movement on the basis of a reference relation are not moved to Explicit memory blocks. The objects in the New area are moved to the Tenured area.
Figures 8-11 and 8-12 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 8-11 Objects that move on the basis of a reference relationship (Example 1)
![[Figure]](FIGURE/ZU081800.GIF)
The objects in the figure move in the following sequence:
- Object 1 is being referenced from an object in the Explicit memory block 1. Therefore, the object 1 moves to the Explicit block 1.
- Object 9 also moves to the Explicit memory block 1 because it is being referenced from the object 1.
- 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.
- 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.
- In the same way as in point 4, the object 12 also does not move.
Figure 8-12 Objects that move on the basis of a reference relationship (Example 2)
![[Figure]](FIGURE/ZU081900.GIF)
The objects in the figure move in the following sequence:
- 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.
- Like object 13, the object 15 is referenced from the Perm area. However, in addition to the reference, the object can be accessed from an object in the Explicit memory block 2 without involving the Perm area or any other Explicit memory block. Therefore, it moves to the Explicit block 2.
- 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.
- In case you cannot secure free space in the Explicit memory block
This corresponds to the case when there is no free space in placement destination the Explicit memory block for placing objects targeted for placement at the time of placing objects in the Explicit memory block. In such cases, you cannot place object in the Explicit memory block. Objects, which cannot be placed, are placed in Java heap area. If you are using API in an incorrect way, an API level exception might occur. For details, see 10.7 Exception class in the uCosminexus Application Server API Reference Guide.
All Rights Reserved. Copyright (C) 2013, 2015, Hitachi, Ltd.