【问题标题】:How to set heap size in play/activator?如何在播放/激活器中设置堆大小?
【发布时间】:2015-03-21 07:57:27
【问题描述】:

运行激活器时出现“java.lang.OutOfMemoryError: Java heap space”。我想将堆设置为无限大小。我在其他地方读到我需要像这样更改 SBT_OPTS 或 _JAVA_OPTION:

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

我在任何地方都找不到关于此的任何文档。

【问题讨论】:

  • 我不知道你是否可以设置无限内存,但你可以通过activator -mem 2048 ...轻松设置内存使用率

标签: scala sbt typesafe-activator


【解决方案1】:

tl;dr activator -help

你可以使用JAVA_OPTS(可能会影响其他java程序),SBT_OPTS(也影响sbt),ACTIVATOR_OPTS(只影响激活器),还有一个-mem标志你可以使用。

我认为-J-Xmx512M 也可以。

➜  ~ activator -help
Usage: activator <command> [options]

  Command:
  ui                 Start the Activator UI
  new [name] [template-id]  Create a new project with [name] using template [template-id]
  list-templates     Print all available template names
  -h | -help         Print this message

  Options:
  -v | -verbose      Make this runner chattier
  -d | -debug        Set sbt log level to debug
  -mem <integer>     Set memory options (default: , which is -Xms1024m -Xmx1024m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m)
  -jvm-debug <port>  Turn on JVM debugging, open at the given port.

  # java version (default: java from PATH, currently java version "1.8.0_25")
  -java-home <path>  Alternate JAVA_HOME

  # jvm options and output control
  -Dkey=val          Pass -Dkey=val directly to the java runtime
  -J-X               Pass option -X directly to the java runtime
                     (-J is stripped)

  # environment variables (read from context)
  JAVA_OPTS          Environment variable, if unset uses ""
  SBT_OPTS           Environment variable, if unset uses ""
  ACTIVATOR_OPTS     Environment variable, if unset uses ""

In the case of duplicated or conflicting options, the order above
shows precedence: environment variables lowest, command line options highest.

【讨论】:

  • Windows 上激活器的 1.3.2 版忽略了 -help-J 选项(help 没有破折号工作),甚至 JAVA_OPTS 也被默默忽略:(。
猜你喜欢
  • 2016-01-22
  • 1970-01-01
  • 1970-01-01
  • 2018-04-26
  • 1970-01-01
  • 2016-02-19
  • 2014-07-31
  • 2012-07-18
  • 2015-07-07
相关资源
最近更新 更多