Manual Creation of Heap Dumps
There a multiple tools and ways to create a heap dump of a running java application manuall. In the following, the creation with the Java Development Kit tools JMAP and JCMD is presented as well as the creation with the GUI tool VisualVM.
Prerequisites
The X4 Server generally runs via a Java JDK process.
The PID of the process is required to create a heap dump for this process. Proceed as follows:
Start the Windows Task-Manager.
Configure the Windows Task-Manager, so that the PID and the command line are shown as columns. To do this, right-click in the header line of the table and activate PID and command line:
Now you can read out the PID:
Java Development Kit Tools
The JDK offers several tools for creating a heap dump. These tools are command line-based.
Possible tools are JMAP and JCMD.
You will find the tools in the following folder in the JDK that is supplied with the server:
<X4-Installation>\Server\jdk\bin
JMAP
Execute the following command in the
<server_directory>/jdk/bin
folder in a command line interface (CLI):
jmap -dump:live,format=b,file=/path/to/heapdump.hprof <pid>
Replace the PID with the PID of the X4 Server that you have previously read out with the Windows Task Manager.
In
/path/to/heapdump
enter the path where you want to save the heap dump.
The path must already exist.
We recommend using an absolute path.
JCMD
Execute the following command in the
<server_directory>/jdk/bin
folder in a command line interface (CLI):CODEjcmd <pid> GC.heap_dump /path/to/heapdump.hprof
Replace the PID with the PID of the X4 Server that you have previously read out with the Windows Task Manager.
In
/path/to/heapdump
enter the path where you want to save the heap dump.
The path must already exist.
We recommend using an absolute path.
Creating Heap Dumps with a GUI Tool
There are several GUI tools for creating heap dumps. We use VisualVM in the following.
Note: Using VisualVM to create a heap dump from an X4 server installed as a service may cause access rights issues if the service is running under a different user than the user running VisualVM.
In the following, we will show you how you can use a VisualVM to create heap dumps.
Download the VisualVM: https://visualvm.github.io/download.html
Start the
visualvm.exe
file in thebin
folder of the downlaod.Search for the PID in the list of processes:
Double-click on the process from which you want to receive the heap dump.
Open the Monitor tab.
Click on the Heap Dump button to open a heap dump.
Save the heap dump by searching for it in the process list on the right-hand side and saving it with the right mouse button: