How to get a Java Heap Dump
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
If you receive the java.lang.OutOfMemoryError: Java Heap Space
error and you have eliminated the usual causes, you may need to get a Java heap dump to determine the cause.
Solution
Getting a heap dump
To get a heap dump add the -XX:+HeapDumpOnOutOfMemoryError
parameter to your system properties.
For example in Linux:
CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<heap_dump_file_path> ${CATALINA_OPTS}"
Next, reproduce the java.lang.OutOfMemoryError: Java Heap Space
error.
The next time you have an out of memory error, a *.hprof file will be created that is approximately the size of your java heap, i.e. 1024m (according to the above example).
Please wait until it's completely written out (before restarting confluence) and attach a zip of this dump to your support case.
Please note that a large -Xmx may make it difficult to open the heap dump.
Memory settings
How to set the heap or permanent generation memory depends on your distribution, platform, and how you start Confluence. Refer to Configuring System Properties.
If you're starting Confluence from a Windows service, make sure you add the properties through the registry settings.
To verify if your settings have been picked up, check Displaying System Properties.