Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven import in Intellij IDEA runs out of memory on a large project

Import of Maven project ends with

Exception java.lang.OutOfMemoryError: GC overhead limit exceeded 
  1. I've tried to define an environment variable: MAVEN_OPTS = -Xmx1g.
  2. I've tried to add -Xmx1g to Maven VM options via Settings -> Build Tools -> Maven -> Runner.

Without success. What else can I do?

like image 731
naXa Avatar asked Sep 30 '15 07:09

naXa


People also ask

How can I increase my idea memory limit in IntelliJ Windows?

From the main menu, select Help | Change Memory Settings. Set the necessary amount of memory that you want to allocate and click Save and Restart.

How do I allocate more memory to Maven?

It is possible to start Maven and sbt with increased memory. We recommend you increase the Maximum Metaspace size and the Thread Stack size. These values can be set using -Xss2M -XX:MaxMetaspaceSize=1024M . The exact values may depend on your hardware and your code base.

What is the maximum heap size in IntelliJ?

Limits the maximum memory heap size that the JVM can allocate for running IntelliJ IDEA. The default value depends on the platform. If you are experiencing slowdowns, you may want to increase this value, for example, to set the value to 2048 megabytes, change this option to -Xmx2048m .


1 Answers

The solution is to set -Xmx1g (or more) in Maven VM options for importer (yes, it is a separate option!). Go to "Settings/Preferences -> Build Tools -> Maven -> Importing", and find the option there.

Maven importing settings

Read more on JVM heap size: (Q) What are the Xms and Xmx parameters when starting JVMs?.

like image 125
naXa Avatar answered Sep 20 '22 15:09

naXa