gpt4 book ai didi

java - 在运行时 Play Framework 2.3 jvm 内存

转载 作者:行者123 更新时间:2023-11-30 03:29:47 25 4
gpt4 key购买 nike

我正在尝试增加应用程序的 Jvm 内存,但无论我使用什么,我都会获得 256Mb 作为最大内存。查看我正在使用的最大内存

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

我尝试运行该应用程序...

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

使用 activator -mem 512 run 或 activator -mem 512 -J-server run 时,出现以下错误。

[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] ^

我这样做的方式不对吗?

最佳答案

通过使用 SET 代替 ENV 并删除双引号来解决。

set JAVA_OPTS=-Xms64m -Xmx512m &&  activator run 

=)

关于java - 在运行时 Play Framework 2.3 jvm 内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29337782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com