简体   繁体   中英

Play Framework 2.3 jvm memory on run

I'm trying to increase Jvm memory of my application but doesn't matter what I use I get 256Mb as max memory. To see the max memory I am using

val instance = Runtime.getRuntime();
val  mb = 1024 * 1024;
val maxm = ("Max Memory: " + instance.maxMemory() / mb);

I tried to to run the app with...

activator -Xms512M -Xmx512M run
activator -mem 512 -J-server run //this doesn't run
env JAVA_OPTS="-Xms512m -Xmx512m"  &&  activator run 
env JAVA_OPTS="-mem 512" &&  activator run 
env JAVA_OPTS="-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=512M"  &&  activator run 
env JAVA_OPTS="-DX:MetaspaceSize=64m -DX:MaxMetaspaceSize=512m"  &&  activator run 

When using activator -mem 512 run or activator -mem 512 -J-server run I get the following error.

[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[error] Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected ';'
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] Expected '-'
[error] 512
[error] ^
[error] Not a valid command: mem (similar: set)
[error] Not a valid project ID: mem
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: mem (similar: name, makePom, make-pom)
[error] mem
[error]    ^

Am I doing this on the wrong way?

Solved by using SET instead ENV and removing double quotes.

set JAVA_OPTS=-Xms64m -Xmx512m &&  activator run 

=)

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