Enabling the Enhanced Heap Dump Feature
Introduction
- JVM provides the capability of dumping process heap data. If sensitive information is stored in the Java process memory, dumping heap files may cause information leakage.
- The enhanced heap dump feature masks the sensitive information while maintaining the heap dump fault locating capability. This feature is of great significance to protect data security and privacy, especially for confidential projects.
Application Scenario
Heap dump files are required for fault locating or performance analysis, and sensitive information in the files needs to be protected from leakage.
Restrictions
- The Java version must match the JDK package that supports this feature.
- Download and install the BiSheng JDK acceleration software package based on Installing the BiSheng JDK Acceleration Library and move the software package to the /usr/lib64 directory. Modify the permission to ensure that the Java process owner can read and execute the software package.
How to Use
You can enable the enhanced heap dump feature in either of the following ways:
- Using VM parameters:
java -Xmx10M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpRedact=full -XX:RedactMapFile=/home/heapmap.txt -XX:RedactMap="password:abc,encrypt:cde" MyClass
- Using jmap command parameters:
jmap -dump:HeapDumpRedact=<names/basic/full/annotation/diyrules/off>,RedactMap="<key1:value1;key2:value2;...>",RedactMapFile=<file path> <pid>
For parameter details, see Table 1.
Parameter |
Description |
|---|---|
-XX:HeapDumpRedact |
Specifies the anonymization mode.
|
-XX:RedactMap |
|
-XX:RedactMapFile |
Obtains the mapping of sensitive names to be masked from the specified file. |
-XX:RedactClassPath |
Specifies annotation classes for sensitive value replacement. |
Parent topic: BiSheng JDK Acceleration Library User Guide