We often receive feedback from users and help diagnose metaspace-related issues, such as the following scenarios
1. Users report Metaspace OOM exceptions, they are eager to know which CLDs load which classes, and why they are not unloaded
2. Users want to know the specific structure of dynamically generated classes in scenarios such as deserialization
3. Going a step further, we want to know the bytecode of a certain method pass
Of course, we can continue to add jcmd commands to meet the needs of users one by one, but another solution once and for all is to implement metaspace dump, dump metaspace into binary files, and users cooperate with the parser to obtain the information they want to know, or even use Presented in a visual way (such as MAT).
Internally we implemented a metaspace dump and helped many users solve some problems, but a more user-friendly way is that JDK can natively support this capability.
The proposed metaspace dump will output dump files in a binary format similar to HPROF. The core design consideration for this feature is what information to output. In preliminary thinking, it will contain the following information:
CLD
-KlassList
Klass
-Flags
-Name
-Annotations(?)
- SuperName
-Interfaces
-Fields
-MethodList
-ConstantPool
Method
-Flags
-Name
-Descriptor
-Annotations(?)
-Max stack
-Max locals
- Size of parameters
-Bytecodes
1. Users report Metaspace OOM exceptions, they are eager to know which CLDs load which classes, and why they are not unloaded
2. Users want to know the specific structure of dynamically generated classes in scenarios such as deserialization
3. Going a step further, we want to know the bytecode of a certain method pass
Of course, we can continue to add jcmd commands to meet the needs of users one by one, but another solution once and for all is to implement metaspace dump, dump metaspace into binary files, and users cooperate with the parser to obtain the information they want to know, or even use Presented in a visual way (such as MAT).
Internally we implemented a metaspace dump and helped many users solve some problems, but a more user-friendly way is that JDK can natively support this capability.
The proposed metaspace dump will output dump files in a binary format similar to HPROF. The core design consideration for this feature is what information to output. In preliminary thinking, it will contain the following information:
CLD
-KlassList
Klass
-Flags
-Name
-Annotations(?)
- SuperName
-Interfaces
-Fields
-MethodList
-ConstantPool
Method
-Flags
-Name
-Descriptor
-Annotations(?)
-Max stack
-Max locals
- Size of parameters
-Bytecodes