marios
marios

Reputation: 8996

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"

Upvotes: 3

Views: 3456

Answers (4)

Amarjeet Singh
Amarjeet Singh

Reputation: 33

You can increase heap size by using below mentioned command in linux environment:-

sbt -J-Xms2048m -J-Xmx2048m assembly

Upvotes: 0

Ken Zhu
Ken Zhu

Reputation: 41

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

set SBT_OPTS="-Xmx2G"
sbt assembly

Upvotes: 0

Mariusz
Mariusz

Reputation: 2737

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

Upvotes: 0

Eugene Yokota
Eugene Yokota

Reputation: 95654

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

Upvotes: 4

Related Questions