uCosminexus Application Server, Expansion Guide
This section describes the implementation for obtaining statistics of the Explicit Memory Management functionality in your application. You can debug and analyze failures by obtaining statistics.
If you have implemented the Explicit Memory Management functionality in your application, you can obtain the following information as statistics:
Also, you can execute the following processes as processes associated with obtaining statistics:
This subsection describes the implementation of each process that uses the Explicit Memory Management functionality API.
This point describes how to obtain information of the Explicit heap. The Explicit heap represents all Explicit memory blocks. For details on how to obtain information of each Explicit memory block, see (3) Obtaining information of Explicit memory block.
This API creates an instance of the java.lang.management.MemoryUsage class and returns the instance.
Information described in the following table is set in each field in the returned instance, as the information at the time of creating the instance.
Table 8-11 Information in each field (instance of MemoryUsage class)
| Field | Setting details |
|---|---|
| init | 0 |
| used | Used memory size of the Explicit heap (units: bytes) |
| committed | Secured size of the Explicit heap (units: bytes) |
| max | Maximum Explicit heap size specified in -XX:HitachiExplicitHeapMaxSize (units: bytes) However, the value is 0 if the Explicit Memory Management functionality is OFF (if -XX:-HitachiUseExplicitMemory is set) |
The following figure shows the values shown by each field.
Figure 8-25 Values shown by each field (instance of MemoryUsage class)
Obtain the Explicit memory block size that is represented by the ExplicitMemory instance, as the status of using Explicit memory block. By using the Explicit memory block size, you can check the status of using the memory in the Explicit Memory Management functionality.
The following table describes the status of using Explicit memory block that you can obtain with each API. You can obtain the size as a long type value.
Table 8-12 Status of using Explicit memory block that you can obtain with each API
| API | Status of using Explicit memory block that you can obtain |
|---|---|
| freeMemory() | Usable memory size (units: bytes) |
| usedMemory() | Used memory size (units: bytes) |
| totalMemory() | Total secured size (units: bytes) |
The following figure shows the values that you can obtain with each API.
Figure 8-26 Values that you can obtain with each API
Obtain the number of the Explicit memory blocks that have an entity in the Explicit heap. The released or invalid Explicit memory blocks are not targeted. If you obtain the number of valid Explicit memory blocks, you can calculate the average memory size used in each Explicit memory block.
This API counts the number of memory blocks in the Explicit heap and returns it as a value of the int type. The Explicit memory blocks meeting the conditions are targeted for counting.
You can set name to an instance corresponding to the Explicit memory block. You can also obtain the set name. An Explicit memory block instance has a name for easy handling in an application. An instance becomes easy to use if you set a name to it.
The set value is also output in an event log of the Explicit Memory Management functionality.
If you do not set a name in your application, the following default name is set.
ID is a value managed by JavaVM.
The Explicit memory block might become non-processable in cases such as failure in securing memory. You can determine whether an Explicit memory block is processable.
The following table describes the mapping of the status of the Explicit memory block (ExplicitMemory instance), when the API is invoked, and the return value of the API.
Table 8-13 Mapping of the status of the Explicit memory block when isActive() is invoked and the return value of the API
| Status of Explicit memory block | Sub-status | Return value |
|---|---|---|
| Released | -- | false |
| Invalid | -- | false |
| Reserved for releasing | -- | false |
| Valid | Enable | true |
| Disable | false |
You can refer to the ExplicitMemory instance corresponding to an Explicit memory block even after the Explicit memory block is reserved for releasing or released. You can check the status of the Explicit memory instance from an application by using the API.
The following table describes the mapping of the status of the Explicit memory block (ExplicitMemory instance), when the API is invoked, and the return value of the API.
Table 8-14 Mapping of the status of the Explicit memory block when isReclaimed() is invoked and the return value of the API
| Status of Explicit memory block | Sub-status | Return value |
|---|---|---|
| Released | -- | true |
| Invalid | -- | true |
| Reserved for releasing | -- | true |
| Valid | Enable | false |
| Disable | false |
All Rights Reserved. Copyright (C) 2013, 2015, Hitachi, Ltd.