Skip to content

Creating a Heap Dump

Akjosch edited this page Apr 19, 2016 · 4 revisions

Occasionally, a simple log file and save game won't suffice to debug the problem. This is especially true for the cases where restarting the game and reloading it "fixes" the problem. In this case, the developers will likely need a "heap dump" - a direct mirror of the game's memory during the runtime.

To generate one, you'll need a full JDK (Java Development Kit) installed, not just the JRE (Java Runtime Environment). You can find it at the same location as the normal Java, currently in Oracle's Java download page. Grab the current JDK for your system and install it if you're experiencing the bug regularly.

One handy tool inside the full JDK installation directory is the "Java VisualVM", usually located under the "bin" subfolder of the installation (it's in bin\jvisualvm.exe in Windows, for example). When the bug strikes, start this tool.

In the "Applications" panel on the left side, expand the "Local" tree. It should have the game (along with every other Java program running on your machine, including Java VisualVM itself). The process name will typically be something along the lines of megamek.MegaMek for MM and mekhq.MekHQ for MHQ.

  • Double-click on the game process to open it.
  • Right-click on the game process, pick "Heap Dump". It should appear right under the process in the tree.
  • Right-click on the heap dump, pick "Save As ...". Save, compress, upload somewhere we can download from. Those can get quite large, so be warned.

Making a thread dump and application snapshot from there is not strictly required, but can be helpful.

Make sure to note which exact version you're using when you submit the heap dump.

If you have a modified game, including your MegaMek.jar, MekHQ.jar and MegaMekLab.jar (they are located either in the installation folder or the lib subfolder) is very helpful as well, but keep in mind that the devs have only limited amount of time and resources and can't be expected to support every custom code there is out there, or very old versions of the game for that matter.

The resulting files can be rather large, even after compression. You will likely need to use a service like DropBox to make them available for download.

Clone this wiki locally