Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OutOfMemoryError: insufficient memory in IntelliJ?

When I run my project in IntelliJ in debug mode I get the following error.

Does anybody know what is the cause? enter image description here

I already increased my heap size in idea.vmoptions:

-ea
-server
-Xms1g
-Xmx3G
-Xss16m
-Xverify:none
-XX:PermSize=512m
-XX:MaxPermSize=1024m

I already increased my heap size for compiler to 1024 as bellow: enter image description here

like image 462
itro Avatar asked Feb 09 '15 14:02

itro


People also ask

How do I resolve low memory issues in IntelliJ?

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 much memory should I allocate to IntelliJ?

IntelliJ IDEA memory usage Follow IntelliJ itself reports that it is using a little more than 1GB of heap but the OS reports that it is using anywhere from 3.5 to 4.5 GB.

How do I fix out of memory error in Java?

Easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options -Xmx512M , this will immediately solve your OutOfMemoryError.

How do I find memory leaks in IntelliJ?

From the main menu, select View | Tool Windows | Profiler. Right-click the necessary process in the Profiler tool window and select CPU and Memory Live Charts. A new tab opens in which you can see the amount of resources the selected process consumes.


1 Answers

You have tried:

  1. Increasing the heap size of the IntelliJ IDEA IDE, which has absolutely no effect on how much memory is available to your program at runtime, and

  2. Increasing the heap size for the compiler, which also has absolutely no effect on how much memory is available to your program at runtime.

Try Run menu -> Edit Configurations... -> find your project in the tree of projects on the left, look for VM options: in the panel on the right, and enter something there, according to information found here: What are the Xms and Xmx parameters when starting JVMs?

That having been said, I should also add that if you are running out of memory without knowingly doing extremely memory hungry stuff, then what you have in your hands is a bug which is causing your program to do runaway memory allocation, which will always be resulting in out-of-memory errors no matter how much you increase your heap size. In that case, you will need to look at your code, not at your project options.

like image 79
Mike Nakis Avatar answered Oct 20 '22 08:10

Mike Nakis