jmap:tldr:ffa13
The command "jmap -dump:live,format=b,file=${filename} ${java_pid}" is used to capture a heap dump of a running Java process.
Here's the breakdown of the command:
-
"jmap" is a command-line utility provided by the Java Development Kit (JDK). It is used to obtain details about the memory usage of a running Java process, including heap utilization.
-
"-dump:live" is an option that instructs jmap to capture a heap dump of only live objects. Live objects are the ones that are still referenced by the application and actively used.
-
"format=b" specifies the format of the heap dump to be in binary format.
-
"file=${filename}" is used to specify the filename and path where the heap dump will be saved. You need to replace "${filename}" with the desired name and location of the heap dump file.
-
"${java_pid}" is a placeholder for the process ID (PID) of the Java process for which you want to capture the heap dump. You need to replace "${java_pid}" with the actual PID of the Java process.
When you run this command, jmap will connect to the specified Java process, capture a snapshot of the live objects in the Java heap, and save it as a binary heap dump file with the specified filename and path. This heap dump can be analyzed using various tools to troubleshoot memory-related issues or to get insights into the memory usage of the Java application.