IntelliJ IDEA: StackOverflowError on Build Project

19,519

Solution 1

Adding -Xss4m to the build process VM options should help:

vm options

Solution 2

If you are getting the issue in Run/Debug configuration, you can change the same in Run->Edit Configurations->VM parameters: -Xms512M -Xmx1024M -Xss4M -XX:+CMSClassUnloadingEnabled

enter image description here

Solution 3

I also met the same problem. I finally fixed it following thes steps:

In IDEA:

  1. File → settings → Build,Execution,Deployment → Build Tools → Maven → Runner VM Options: add -Xss4096k

  2. File → settings → Build,Execution,Deployment → Compiler Shared build process VM options: add -Xss4m

Share:
19,519

Related videos on Youtube

d-_-b
Author by

d-_-b

Updated on July 12, 2022

Comments

  • d-_-b
    d-_-b almost 2 years

    I am using the following IntelliJ.

    IntelliJ IDEA 2017.2 EAP
    Build #IU-172.2953.9, built on June 14, 2017
    IntelliJ IDEA EAP User
    Expiration date: July 14, 2017
    JRE: 1.8.0_152-release-915-b3 x86_64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Mac OS X 10.12.5
    

    I have been getting java.lang.StackOverflowError upon building the project.

    Has anyone fallen into the same situation?

    Build Message↓

    Information:java: The system is out of resources.
    Information:java: Consult the following stack trace for details.
    Information:java:   at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1955)
    Information:java:   at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786)
    Information:java:   at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571)
    Information:java:   at com.sun.tools.javac.code.Types.asSuper(Types.java:1952)
    Information:java:   at com.sun.tools.javac.code.Types.unboxedType(Types.java:3987)
    Information:java:   at com.sun.tools.javac.code.Types.unboxedTypeOrType(Types.java:3998)
    Information:java:   at com.sun.tools.javac.comp.DeferredAttr$ArgumentExpressionKind.standaloneKind(DeferredAttr.java:1135)
    Information:java:   at com.sun.tools.javac.comp.DeferredAttr$DeferredChecker.visitLiteral(DeferredAttr.java:1296)
    Information:java:   at com.sun.tools.javac.tree.JCTree$JCLiteral.accept(JCTree.java:2037)
    Information:java:   at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    Information:java:   at com.sun.tools.javac.comp.DeferredAttr$FilterScanner.scan(DeferredAttr.java:913)
    Information:java:   at com.sun.tools.javac.comp.DeferredAttr.isDeferred(DeferredAttr.java:1100)
    Information:java:   at com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:669)
    Information:java:   at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1815)
    Information:java:   at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
    Information:java:   at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:575)
    Information:java:   at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3249)
    Information:java:   at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
    Information:java:   at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1824)
    Information:java: Errors occurred while compiling module 'webapi'
    Information:javac 1.8.0_101 was used to compile java sources
    Information:2017/06/21 21:22 - Compilation completed with 1 error and 49 warnings in 24s 170ms
    Error:java: java.lang.StackOverflowError
    
    • Nikolas
      Nikolas almost 7 years
      Check your Workspace for the '.meatadata/.log', maybe you will find a hint there
    • CrazyCoder
      CrazyCoder almost 7 years
      Post the full exception stack trace.
    • d-_-b
      d-_-b almost 7 years
      @CrazyCoder That is all I got.
    • CrazyCoder
      CrazyCoder almost 7 years
      Try adding -Xss4m here.
    • d-_-b
      d-_-b almost 7 years
      @CrazyCoder Thank you! It worked!
  • chomp
    chomp about 5 years
    2019 and that amount of memory is still enough :)
  • Shubham Patil
    Shubham Patil over 2 years
    I tried this but it was not working even when i increased that memory to 8192m. So turns out that i was missing adding it in File → settings → Build,Execution,Deployment → Build Tools → Maven → Runner VM Options, as already mentioned in one of the answer below.