How to fix the java.lang.OutOfMemoryError exception

The java.lang.OutOfMemoryError exception can be fixed by increasing the memory allocated for Java. To fix the error, identify the particular type of the java.lang.OutOfMemoryError you've got.

Depending on the exception reason, you should run YouTrack with the corresponding start parameter to solve the problem. Please refer to the table below:

Reason Fix and Java Parameter Sample
Java heap space  Increase heap size via -Xmx Java start parameter.  -Xmx1g sets allocated heap size to 1Gb
Metaspace  Increase MaxMetaspaceSize parameter via 

GC overhead limit
Increase heap size via -Xmx parameter.  -Xmx1024m sets heap space to 1024mb. 
6 out of 34 found this helpful

What about java.lang.OutOfMemoryError: Metaspace ?

"Starting from Java 8, the memory model in Java was significantly changed. A new memory area called Metaspace was introduced and Permgen was removed." - per


@Jeff Fritz

Have a look at the documentation here -

Initially our installation had set MaxMetaSpaceSize to 250m, but we kept getting

java.lang.OutOfMemoryError: Metaspace

As a workaround I have tried setting MaxMetaSpaceSize to 350m. I'll report back here if this doesn't work.



I set the heap space to 16GB worked for a couple of weeks, and the issue re-appeared, i have a total of 32gb on manjaro linux.


I managed to get my application running by going to "Intellij -> Preference -> Compiler -> Shared Build Process Heap Size" and adjusting the override size to use 16gb also.

I still feel like this is some sort of caching issue though.


Please sign in to leave a comment.

Have more questions?

Submit a request