java: java.lang.OutOfMemoryError: Java heap space on Hello World

Answered

On running any project, even a simple Hello, World, I will get the following error while it is still building:

Executing pre-compile tasks...
Running 'before' tasks
Checking sources
Parsing java… [OBP]
java: compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.4, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java: java.lang.OutOfMemoryError: Java heap space
java: at jdk.compiler/com.sun.tools.javac.util.IntHashTable.rehash(IntHashTable.java:175)
java: at jdk.compiler/com.sun.tools.javac.util.IntHashTable.putAtIndex(IntHashTable.java:146)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser$SimpleEndPosTable.storeEnd(JavacParser.java:4257)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.storeEnd(JavacParser.java:490)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:696)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:597)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1143)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:859)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:830)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:786)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:766)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:717)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1835)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1847)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1233)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2460)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.blockStatements(JavacParser.java:2370)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.block(JavacParser.java:2340)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.block(JavacParser.java:2354)
java: at jdk.compiler/com.sun.tools.javac.parser.JavacParser.methodDeclaratorRest(JavacParser.java:3803)
java: Compilation failed: internal java compiler error
Checking dependencies… [OBP]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'OBP'
javac 11.0.4 was used to compile java sources
Finished, saving caches…
Compilation failed: errors: 1; warnings: 0
Executing post-compile tasks...
Compilation failed: errors: 1; warnings: 0
Synchronizing output directories...
08.05.23, 21:37 - Build completed with 1 error and 0 warnings in 6 sec, 534 ms
 
I have uninstalled, installed IntelliJ, made new Projects, restarted my pc, .... Every other IDE works just fine, just IntelliJ stopped working from one second to another, cant work like this :/!
0
7 comments

Allocating more Heap Space does nothing, enabling the Heap Space Status Bar Widget reveals that in fact not even 10% of the possible space is used, yet it still always crashes on this error, wtf?

0

Try installing a more recent JDK build and use it to build the project instead of 11.0.4 version.

Compiler heap size can be changed here:

1

Per Develop Standards I am bound to be using this JDK version.

Building on 8gb of Heap Size and it taking more than 2 minutes and still running for a simple "Hello, World!" Main indicates to me that the IDE must be deeply broken, but since I did not change anything I dont know what else to try except change IDEs

0

It looks like your JDK installation is broken, not IntelliJ IDEA. I would try reinstalling it.

JDK builds contain important bug and security fixes. Current JDK 11 build is 18, you are using 4. I don't see any reason why your project cannot be updated from JDK 11.0.4 to 11.0.18. Do you know why you can't switch to 11.0.18 JDK version? What development standard says not to install bugfix and security fix revisions of the same JDK major version?

0

JDK version was provided by my supervisor, I can ask if we can switch but I dont think thats a possibility, also shouldnt other IDEs stop working as well if the error lies with the JDK or is that not the case?

0

>  also shouldnt other IDEs stop working as well if the error lies with the JDK or is that not the case?

The world is not that simple. It's clearly a JDK bug and only one IDE can be a trigger as the bug may depend on the order of options/files and other factors.

Instead of wasting more time, I would install JDK 11.0.18 and rebuild the project with it.

 

0

For me installing a more recent JDK build and used it to build the project instead of  lower version and it worked. Thanks a ton!!!

0

Please sign in to leave a comment.