Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure metaspace with SBT

Tags:

I'm trying to configure metaspace for SBT

export SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=256M -Xms2G -Xmx2G"

but when I run sbt -v, I have the following output :

[process_args] java_version = '1.8.0_11'
# Executing command line:
java
-XX:+CMSClassUnloadingEnabled
-XX:MaxMetaspaceSize=512M
-XX:MetaspaceSize=256M
-Xms2G
-Xmx2G
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxMetaspaceSize=256m
-jar
/usr/local/Cellar/sbt/0.13.7/libexec/sbt-launch.jar

The problem seems that my custom value for MaxMetaspaceSize is overrided with another value, as shown in output above.


SBT version : 0.13.7

Java version : 1.8

OS : OSX

like image 563
Yann Moisan Avatar asked Feb 24 '15 17:02

Yann Moisan


1 Answers

(copy-pasted from a dear coworker who found the solution)

sbt -mem 2048

=>

-Xms2048m
-Xmx2048m
-XX:ReservedCodeCacheSize=256m
-XX:MaxMetaspaceSize=512m

the default metaspace is based on the xmx value specified with the "-mem" option ;-)

like image 178
Siegfried Ehret Avatar answered Sep 27 '22 22:09

Siegfried Ehret