Increase the amount of memory in the sbt assembly

Is there a way to increase memory size during build (plugin)? I notice that adding more memory to sbt via SBT_OPTS doesn't really help. I suspect the assembly is deploying a separate JVM that does not inherit JVM config from sbt.

Here is the error:

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

Here's what I've tried without much luck:

javaOptions in assembly += "-Xmx2g"

+3


source to share


3 answers


I suspect the assembly is deploying a separate JVM that does not inherit JVM configurations from sbt.



I am the author of sbt-assembly. assembly

does not fork a separate JVM. You can see the code here and check - https://github.com/sbt/sbt-assembly/blob/0.13.0/src/main/scala/sbtassembly/Assembly.scala#L239-L246

+5


source


Be sure to export SBT_OPTS. Mine is -Xmx2G -XX: + UseConcMarkSweepGC -XX: + CMSClassUnloadingEnabled -XX: MaxPermSize = 2G -Xss2M "



0


source


I've met the same problem before, please do it like below for Windows. The question could disappear.

set SBT_OPTS="-Xmx2G"
sbt assembly

      

0


source







All Articles