7.19.8 -XX:MetaspaceSize
-XX:MetaspaceSize specifies the standard value for full GCs that originate in the Metaspace area.
Description
-XX:MetaspaceSize specifies the standard value for full GCs that originate in the Metaspace area.
The Metaspace area stores the class information that was loaded.
You can estimate the size of the Metaspace area based on the size of the class information required for applications. Specify the estimated value for the -XX:MetaspaceSize option and the -XX:MaxMetaspaceSize option. By specifying an appropriate size for the Metaspace area, the occurrence of an OutOfMemoryError in the Metaspace area can be prevented. In addition, by specifying the same value for the -XX:MetaspaceSize option and the -XX:MaxMetaspaceSize option, the occurrence of full GCs that originate in the Metaspace area can be prevented.
The memory usage rate of the Metaspace area is the size of the memory that is actually being used by applications. Therefore, the memory of the size specified for the -XX:MetaspaceSize option and the -XX:MaxMetaspaceSize option is not used. By using this feature, you can tune the Metaspace area as follows:
-
You can reduce the risk of an OutOfMemoryError in the Metaspace area.
When the memory usage rate of the Metaspace area exceeds the estimated value, an OutOfMemoryError in the Metaspace area might occur. To reduce this risk, estimate and specify appropriate values for the following options:
-
-XX:MaxMetaspaceSize
-
-XX:CompressedClassSpaceSize
An OutOfMemoryError occurs in the Metaspace area only when the memory usage rate of the Metaspace area exceeds the values specified for these options.
-
-
You can reduce the risk of full GC that originates in the Metaspace area.
If the memory usage rate of the Metaspace area exceeds the estimated value, a full GC that originates in the Metaspace area might occur. To reduce this risk, estimate and specify appropriate values for the following options:
-
-XX:MetaspaceSize
-
-XX:MaxMetaspaceSize
-
-XX:CompressedClassSpaceSize
A full GC that originates in the Metaspace area occurs only when the memory usage rate of the Metaspace area exceeds the values specified for these options.
-
Syntax
-XX:MetaspaceSize=size
Specifiable values
- size
-
Type: Integer
Specify a natural number followed by one of the following characters. The size is specified in units of bytes.
-
k for kilo
-
m for mega
-
g for giga
-
t for tera
The specifiable values are described below.
- For 32-bit Java VM:
-
An integer value from 256K to 232-1.
- For 64-bit Java VM:
-
An integer value from 256K to 264-1.
Note that the specification of this value is not case sensitive.
-