简体   繁体   中英

Increase memory in sbt-assembly

Is there a way to increase the memory during assembly (the plugin)? I notice that adding more memory to sbt through SBT_OPTS does't really help. I suspect that assembly is forking a separate JVM that doesn't inherit the JVM configurations from sbt.

Here is the error:

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

Here is what I tried without much luck:

javaOptions in assembly += "-Xmx2g"

I suspect that assembly is forking a separate JVM that doesn't inherit the JVM configurations from sbt.

I'm 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

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

I met the same issue before, Please do it as below for windows. The issue could be gone.

set SBT_OPTS="-Xmx2G"
sbt assembly

您可以在Linux环境中使用以下提到的命令来增加堆大小:

sbt -J-Xms2048m -J-Xmx2048m assembly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM