How to get a Java Heap Dump
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.