Using Memory Dumps to Analyze OutOfMemoryErrors
One of the most effective ways of troubleshooting and identifying memory problems within JIRA applications is to have Java output the contents of its memory into a heap dump. There are arguments that will tell the Java Virtual Machine (JVM) to do this automatically when it encounters an OutOfMemoryError (OOME). These heap dumps can then be analysed to identify problems within JIRA applications.
To enable the JVM to generate a heap dump on an OutOfMemoryError, add the following arguments to the JVM as in our Setting Properties and Options on Startup documentation. If JIRA applications run out of memory, it will create a
jira_pid*.hprof file containing the heap dump in the directory specified below. If you use your
$JIRA_INSTALL directory for this, it will be easy to locate.
-XX:HeapDumpPath parameter is optional. If it is not used, the heap dump will be generated within the Java working directory.
If you are running JIRA on Windows and this setting has been configured in the Windows registry (i.e. because JIRA is running as a service), then each parameter needs to be placed on a new line, for example:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Program Files\Atlassian\JIRA\
When a heap dump is generated, it will be the size of the current heap (e.g.: a 4gb heap will have a 4gb heap dump). If you are running a JIRA application instance with a large heap (greater than 4096mb), it can make it harder to analyse as significant resources are required to analyse large heap dumps.
It is also possible to manually generate a heap dump, as in this documentation. However if a heap dump is not generated when an OutOfMemoryError is thrown, it is generally not at all useful.
In addition to heap dumps, you can also use GC logging for analysis. Please refer to our How to troubleshoot Jira Server performance with GC logs KB article for further information on this.
It is unwise to provide general recommendations for all situations - there is no substitute for an in-depth assessment using analysis tools. Atlassian recommends engaging the services of an Atlassian Expert for performance analysis of JIRA applications and the environment they run in.