scalaintellij-ideasbtscala-breeze

scalac :Out of memory during building Breeze


I'm trying to build Breeze by myself using Intellij IDEA

Here's my enviroment
Intellij version:2018.2.1 Community
OS:Windows 10 64-bit
JDK version:1.8.0_181
scala SDK version:2.12
sbt version: sorry.. can't find it.

At First, It kept showing the error message : java.lang.OutOfMemoryError: GC overhead limit exceeded

What I've done:
1. In "Custom VM Options", add "Xmx2048m"

2. In Settings(ctrl+alt+s)=>Build,Execution,DeployMent=>Build Tools=>sbt
change "Maximum heap size" to 9196 (really large...)

3. In Settings(ctrl+alt+s)=>Build,Execution,DeployMent=>Compiler=>Scala Compiler=>Additional compiler options, add "-J-Xmx4096m"

4. In Scala Compiler=>Scala Compile Server, change JVM maximum heap size to 4096

After doing these things, I still got a some chances to fail because out of memory during compiling.
Am I missing anything important?


Solution

  • It seems you are using IntelliJ internal build system. Instead, try configuring IntelliJ to delegate building to sbt proper like so:

    1. Enable setting: Use sbt shell for build and import (required sbt 0.13.5+)

    2. Create .jvmopts file at the root of your project:

      -Xmx4G 
      -XX:MaxMetaspaceSize=4G
      
    3. In the sbt projects tool window, click sbt tasks node, and select the task you wish to run. Note, build commands from the main menu, for example,Build | Build Project, should now also be hooked into system SBT

    4. Monitor the execution output in sbt shell tool window