OOME at compile time on Java 64-bits

Compilation fails for one of my IntelliJ projects, running on:
Windows Vista x64
Java 1.6.0_12 64-bits
Error occurs on both IntellJ 8.1 and Diana #9757


I don't get any errors with neither Ant or Maven.


My idea.exe.vmoptions file looks like this:


-server

-Xms512m

-Xmx512m

-XX:MaxPermSize=150m

-XX:MaxGCPauseMillis=10

–XX:MaxHeapFreeRatio=70

-XX:+UseConcMarkSweepGC

–XX:+CMSIncrementalPacing

-XX:+TieredCompilation

-Didea.no.jdk.check=true

-Dsun.awt.keepWorkingSetOnMinimize=true


Since IntelliJ comes bundled with the 32-bits version of JRE, I had to set IDEA_JDK=%JAVA_HOME%, and then run idea.bat to force IntellJ using IDEA_JDK (really wonder why idea.exe doesn't behave the same way...)


The current project contains 2000+ java files. Significantly smaller projects do compile. Appearantly, size matters in this case...


Here is the stack trace:

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: GC overhead limit exceeded
      at com.sun.tools.javac.code.Scope.makeEntry(Scope.java:203)
      at com.sun.tools.javac.code.Scope.enter(Scope.java:196)
      at com.sun.tools.javac.code.Scope.enter(Scope.java:183)
      at com.sun.tools.javac.code.Scope.enter(Scope.java:179)
      at com.sun.tools.javac.jvm.ClassReader.includeClassFile(ClassReader.java:2021)
      at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2159)
      at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2077)
      at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1781)
      at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
      at com.sun.tools.javac.jvm.ClassReader.completeOwners(ClassReader.java:1793)
      at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1772)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:758)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.members(Symbol.java:695)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.findAccessMethod(ClassReader.java:1290)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:1280)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompoundList(ClassReader.java:1269)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotation(ClassReader.java:1444)
      at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)
      at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)
      at com.sun.tools.javac.comp.Enter.complete(Enter.java:472)
      at com.sun.tools.javac.comp.Enter.main(Enter.java:429)
      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
      at com.sun.tools.javac.main.Main.compile(Main.java:353)
      at com.sun.tools.javac.main.Main.compile(Main.java:279)
      at com.sun.tools.javac.main.Main.compile(Main.java:270)
      at com.sun.tools.javac.Main.compile(Main.java:69)
      at com.sun.tools.javac.Main.main(Main.java:54)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Compilation completed with 1 error and 0 warnings
1 error
0 warnings
Error:Compiler internal error. Process terminated with exit code 3


Any help appreciated!


-Runar Botten



4 comments
Comment actions Permalink

Try to give the compiler more memory in: Settings > Compiler > Java Compiler > Maximum heap size (MB)

Bas

0
Comment actions Permalink

Thanks a lot, Bas! That solved the problem.

Any idea why this is actually happening on Vista x64/Java x64, but not on XP x32 (exact same project)? Is it as simple as that the compiler requires more memory on x64?

Also, do you know any reason why I had to run idea.bat instead of idea.exe to force IntellJ using IDEA_JDK in order to override the bundled JRE?

Runar

0
Comment actions Permalink

runar@finntech.no wrote:

Any idea why this is actually happening on Vista x64/Java x64, but not on XP x32 (exact same project)? Is it as simple as that the compiler requires more memory on x64?

Yes, because of for example the 64 bit pointers instead of 32 bit, many programs running on a 64 bit jvm need a lot more memory when compared to running on a 32 jvm. About 50% more memory is used on a 64 bit jvm is the consensus. Because of the larger memory use, processor cache misses can also happen more often, causing loss of performance. I recommend to use the 64 bit jvm only for programs that need the extra memory that is accessible (> 1,5 to 2 GB). There is also version of the jvm which allows to use compressed pointers (http://wikis.sun.com/display/HotSpotInternals/CompressedOops ) to take less of a performance and memory hit, but I do not know if that is generally available and production ready.

Bas

0
Comment actions Permalink

Thanks for really good answers!

0

Please sign in to leave a comment.