7.13.2 Using the Explicit Memory Management functionality by using the automatic placement configuration file
Set the automatic placement functionality in the Explicit Memory Management functionality by using the automatic placement configuration file. If you use the automatic placement configuration file, you can use the Explicit Memory Management functionality without making changes to the Java program.
In the automatic placement configuration file, specify objects that you want to place in the Explicit heap and the location of generating the objects. Note that the objects that are being referenced from the objects that you specify in this file (objects generated in the Explicit memory block) move to the Explicit memory block from the Java heap. For details on the object movement, see 7.6.5 Moving the objects from the Java heap to the Explicit memory block based on a reference relation.
This subsection describes the coding format of the automatic placement configuration file and points you need to consider during coding, if you use the Explicit Memory Management functionality by specifying the -XX:+HitachiAutoExplicitMemory option and by using the automatic placement configuration file.
You can code the contents of the automatic placement configuration file by using one of the following items:
-
Easy Setup definition file
-
[Setting startup parameters] screen (defining the logical J2EE server) in the management portal
-
Any user file (file specified in the jvm.userprf.File property)
- Organization of this subsection
(1) Coding format of the automatic placement configuration file
Coding format of the automatic placement configuration file is as follows.
<Generation point>#, <fully classified class name of the specified object> # Comment : <Generation point>#, <fully classified class name of the specified object>
- #
-
Examples of the specification of generation point are described below.
Example of generation point
Meaning
*
This specifies generation of the user-specified objects in all the methods that are included in all classes in all packages, as the generation point.
com.sample.*
This specifies generation of the user-specified objects in the methods that are included in classes in all packages that start with com.sample, as the generation point.
Therefore, if lower packages (com.sample.abc or com.sample.abc.test) exist, those are also targeted.
com.sample.Main
This specifies generation of the user-specified objects in all the methods (including constructor and static initializer) that are included in com.sample.Main class, as the generation point.
com.sample.Main.main(java.lang.String[])
This specifies generation of the user-specified objects in the main(java.lang.String[]) method that is defined in the com.sample.Main class, as the generation point.
- Tip
-
-
A single byte space (0x20) or tab (\t or 0x09) is the blank character that separates syntax elements.
-
One or more line feed characters (\n or 0x0A) or return characters (\r or 0x0D) continue at end-of-line.
-
Comments start with # and all characters in between # and end-of-line are considered as a comment.
-
* character in generation point indicates all classes existing in same or subpackages. Meaning of * in import declaration of Java language and * in generation point differs on the point that * in generation point targets classes in subpackages also.
-
(2) Example of coding the automatic placement configuration file
An example of coding the automatic placement configuration file is described below.
# comment com.sample.*, java.util.ArrayList # comment com.sample.Main.main(java.lang.String[]), java.util.LinkedList
This point describes contents of the coding example.
-
All first lines are comments.
-
Specify in such a way that the java.util.ArrayList object, generated by the class and method, which is included in all packages starting with com.sample. * is placed in the Explicit memory block. Text from # until end-of-line is considered as a comment.
-
Specify in such a way that the java.util. LinkedList object generated by the com.sample.Main.main(java.lang.String[]) method is placed in the Explicit memory block.
- Reference note
-
You can describe the entries that specify a class in JavaVM (for example, class in packages starting with java, javax), as a generation point for the user-specified object. However, specified entries might be treated as if they do not exist. If an entry is treated as if it does not exist, an error message is not output in the Explicit Management Heap log.
(3) Notes for the automatic placement configuration file
The following point describes the points to be considered when you specify the automatic placement configuration file.
-
If you use the automatic placement functionality, class loading time increases. As a result, the JavaVM starting time or application deployment time on Application Server might increase.
-
Using the automatic placement functionality might increase the copy GC processing time.
-
The automatic placement functionality targets only those objects that are generated with new. The functionality does not target the objects generated with JNI or reflection.
-
Describe all class names and method arguments, including classes in the java.lang package in a fully classified class name.
- For example:
-
Incorrect: String
Correct: java.lang.String
-
You cannot describe a class name that uses generics. Describe the class names (raw type) that are not parameterized.
- For example:
-
Incorrect: java.util.HashMap<java.lang.String, java.lang.Object>
Correct: java.util.HashMap
-
Describe nested class names separated by "$" and not ".".
- For example:
-
Incorrect: java.util.AbstractMap.SimpleEntry
Correct: java.util.AbstractMap$SimpleEntry
-
For constructor, code the same method name as the class name or init. For the constructor of MyMain class, code as shown below.
- For example:
-
MyMain.MyMain() or MyMain. init()
-
If a method having the same name as a class exists, it is not possible to determine whether you are specifying a constructor or a method. Therefore, it is treated as if you have specified both a constructor and method.
- For example:
-
A constructor containing an int argument of MyMain.MyMain(int) # MyMain class and a # MyMain(int) method are both generation points
-
Describe clinit for static initializer. For static initializer of the MyMain class, code as shown below.
- For example:
-
MyMain.clinit()
-
If you want to specify generation of an object, by assigning at the time of field declaration, as the generation point, describe default constructor in generation point.
-
You cannot specify an array in a fully classified class name of the user-specified object.
- For example:
-
java.lang.String[]
-
If a line containing a non-existing class name, method name or a method (native method and abstract method) not having byte code exists, treat that line as if it does not exist
-
If you specify an internal class of J2SE in class name of the user-specified object, the Explicit Memory Management functionality might be replaced by an appropriate class name. For example, java.util.HashMap is replaced with java.util.HashMap$Entry.
-
If you specify a huge class or method, which is close to the limit of the Java language specifications, as a generation point, automatic placement might fail. In that case, "Invalid class file format" is output as MESSAGE of explicit management heap automatic placement error in event log of the Explicit Memory Management functionality. In such cases, review size reduction of class or method.