Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot increase memory for sbt console #2945

Closed
samthebest opened this issue Jan 27, 2017 · 7 comments
Closed

Cannot increase memory for sbt console #2945

samthebest opened this issue Jan 27, 2017 · 7 comments

Comments

@samthebest
Copy link

steps

Try to set memory using http://stackoverflow.com/a/15281562/1586965

export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M  -Duser.timezone=GMT"

Run sbt console

Runtime shows sbt does not respect my settings

scala> Runtime.getRuntime().freeMemory() / 1000 / 1000
res1: Long = 778

scala> Runtime.getRuntime().maxMemory() / 1000 / 1000
res2: Long = 1037

problem

I get 1G

expectation

I get 2G

notes

Really? 2017? :P

@dwijnand
Copy link
Member

What operating system are you using? What sbt launcher are you using (for example how did you install it)?

@samthebest
Copy link
Author

samthebest commented Jan 27, 2017

Mac OS 10.11.6

> sbt sbt-version
...
[info] 0.13.9

I installed sbt with brew install sbt

@dwijnand
Copy link
Member

dwijnand commented Jan 27, 2017

I can't reproduce it:

18:16:36 $ export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M  -Duser.timezone=GMT"

18:16:51 $ /usr/local/opt/sbt/bin/sbt -v console
[process_args] java_version = '1.8.0_112'
# Executing command line:
java
-Xmx2G
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=2G
-Xss2M
-Duser.timezone=GMT
-jar
/usr/local/Cellar/sbt/0.13.13/libexec/sbt-launch.jar
console

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=2G; support was removed in 8.0
[info] Loading global plugins from /Users/dnw/.dotfiles/.sbt/0.13/plugins
[info] Loading project definition from /s/u/project
[info] Set current project to t (in build file:/s/u/)
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> Runtime.getRuntime().maxMemory() / 1000 / 1000
res0: Long = 2077

Could you check by adding -v what output you're seeing compared to mine?

@samthebest
Copy link
Author

Interesting, when I use -v, an additional -Xmx option can be seen that comes after the -Xmx2G, I assume this overrides it - where is this option coming from??

> sbt -v console
[process_args] java_version = '1.8.0_74'
# Executing command line:
java
-Xmx2G
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-Xss2M
-Duser.timezone=GMT
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxMetaspaceSize=256m
-jar
/usr/local/Cellar/sbt/0.13.9/libexec/sbt-launch.jar
console

@dwijnand
Copy link
Member

dwijnand commented Feb 5, 2017

I think you might be using a version of sbt-launcher-package that predates this fix: sbt/sbt-launcher-package#101

@samthebest
Copy link
Author

@dwijnand

I ran brew upgrade sbt and now

# Executing command line:
java
-Xmx2G
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-Xss2M
-Duser.timezone=GMT
-jar
/usr/local/Cellar/sbt/0.13.13/libexec/sbt-launch.jar
console

scala> Runtime.getRuntime().maxMemory() / 1000 / 1000
res0: Long = 2077

Many thanks!!

@dwijnand
Copy link
Member

dwijnand commented Feb 5, 2017

Cool! :)

@dwijnand dwijnand closed this as completed Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants