Confluence crashes due to 'OutOfMemoryError Java heap space' error
Confluence hangs or behaves unexpectedly.
The atlassian-confluence.log will contain an error message like:
java.lang.OutOfMemoryError: Java heap space
Configure Java to produce a heap dump when it throws an OutOfMemoryError. Heap dumps can be used to determine what was in memory, and thereby find memory leaks and determine what parts of the system are using too much memory. To generate a heap dump once an out of memory error occurs, add the following arguments to your Confluence as per the Configuring System Properties document:
Generating a heap dump will create a file that is the same size as your JVM heap, so if you have allocated 2 GB to your JVM's maximum heap size, the heap dump will be 2 GB.
Please ensure there is enough space on the drive or directory defined on the <heap_dump_file_path> for this file to be created.
Also, we do not recommend this setting for heaps larger than 2gb, unless it is specifically instructed by Atlassian Support for troubleshooting a specific problem.
The Java heap space allocation has been exceeded. This can happen either from a memory leak in the application or from normal usage requiring more memory.
There are several known causes:
- The XML Backup is one known memory hog. Check Cannot create or restore XML backup due to OutOfMemory errors.
- Heavy usage of the Office Connector or large office files can cause Out Of Memory Errors, for example, CONF-17113.
- Using HSQLDB (the evaluation database) can cause memory problems.
- Upgrading Confluence from a version pre-3.5 to a version 3.5 or above, if Confluence was already close to using the maximum heap space, as Confluence's memory use increased by about 250 MB with version 3.5.
- If you're using the XML backup, disable it and use the Production Backup Strategy. Check Cannot create or restore XML backup due to OutOfMemory errors for more information.
- Upgrade Confluence - we continue to fix root causes for Out Of Memory Errors.
- If you're using the evaluation database, Migrate to a Production Database.
- If your usage patterns have increased, you likely just need to tweak your memory settings. See Fix Out of Memory errors by Increasing Available Memory. When increasing heap space, pay attention to Garbage Collection performance.