1

I get this error when running my app in intelliJ:

[error] (ABCThread-1) java.lang.OutOfMemoryError: Java heap space

Therefore, I am trying to set the heap size when i run my scala app from SBT Console / SBT Action:

I use the following : found here: Increase JVM heap size for Scala?

However i get the error:

scala>  -J-Xmx2g
<console>:12: error: object - is not a member of package scala
       scala -J-Xmx2g
             ^
<console>:12: error: not found: value J
       scala -J-Xmx2g
              ^
<console>:12: error: not found: value Xmx2g
       scala -J-Xmx2g
                ^

any idea? thnks

uniXVanXcel
  • 807
  • 1
  • 10
  • 25
  • 1
    set SBT_OPTS may help for example `export SBT_OPTS="-Xmx2048m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=768m -Xss16m` – shengshan zhang Jun 06 '18 at 02:11
  • @shengshanzhang i get this error : `:13: error: not found: value export export SBT_OPTS` same thing if i use `set SBT_OPTS` I get `:13: error: not found: value set set SBT_OPTS` – uniXVanXcel Jun 06 '18 at 13:25
  • I tried setting SBT_OPTS in the environment variable and it worked like charm for me: SBT_OPTS: -Dsbt.override.build.repos=true -Xmx2048m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=768m -Xss16m .From Intellij, you can follow the documentation: https://www.jetbrains.com/help/idea/increasing-memory-heap.html – Sangeeta Jun 10 '20 at 07:16

3 Answers3

7

where you should input the VM paramer

the position is where you should input the VM parameters if you use IDEA

shengshan zhang
  • 538
  • 8
  • 16
0

1.Edit the VM Options field in the run/debug configuration of the app that you start. vmoptions file adjusts the memory used by IntelliJ, If I am not wrong, you are having a shortage of memory of JRE that is launched by IntelliJ to execute your app. Adjust the memory setting in VM options part of the Run/Debug configuration,for eg:https://i.stack.imgur.com/8U65i.jpg config setting

2.If step-1 not solved your problem switch to 64-bit JDK for IntelliJ IDEA if you are not using currently.

devesh
  • 618
  • 6
  • 26
0

Go to IntelliJ preferences > Build,Execution,Deployement > compiler. You'll find an option to set heap size as Build process heap size(Mbytes):. Change it to some higher value. It may solve the issue.

Praseeth S
  • 111
  • 1
  • 6