k0pernikus
k0pernikus

Reputation: 66717

How to set memory on a per project basis in sbt?

Currently, for a scala project I have to increase the memory to run its test via:

sbt -mem 2000 test

to set it to 2 GB.

I want to store the memory config in a file file inside the project (shared via git) so that every developer has this setting in place. Is that possible and if so how do I achieve that?

When I run:

sbt -v
[process_args] java_version = '8'
# Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxMetaspaceSize=256m
-jar
/usr/share/sbt/bin/sbt-launch.jar

I see that it defaults to 1024 MB, yet I fail to see where it gets that default values from nor how how to override it.

Sbt's man pages references as default: $sbt_mem, which is $(get_mem_opts $sbt_mem yet this also does not help my understanding on where to change it.

Upvotes: 1

Views: 114

Answers (1)

Mario Galic
Mario Galic

Reputation: 48420

Try creating .jvmopts file at the root of the project like so

-Xmx2G 

Also consider related answer https://stackoverflow.com/a/54725010/5205022

Upvotes: 3

Related Questions