【问题标题】:Play Framework - can not reserve enough space for object heapPlay Framework - 无法为对象堆预留足够的空间
【发布时间】:2013-01-16 22:55:45
【问题描述】:

我对我的游戏项目进行了一些修改,当我尝试运行它时出现错误。

>play run
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occured. Program will exit.

这是一个常见问题吗?我对播放框架相当缺乏经验,但我之前已经运行了几次我的项目而没有遇到这个错误。

编辑:有关 java 版本的信息。

>java -version
java version "1.7.0_11"
Java(TM) Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode, sharing)

【问题讨论】:

标签: java memory playframework-2.0 java-7 heap-memory


【解决方案1】:

在 Play framework 2.0.3 中,<play framework install dir>\framework\build.bat 脚本需要替换下面命令的命令行参数

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

进入

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

它解决了我的问题。

更多信息请参考this post

【讨论】:

  • 不修改 .bat 文件(在我的 Play!2.3.8 安装中称为 activator.bat,位于我项目的根目录中),您还可以创建一个名为 @ 的环境变量987654327@ 并在其中存储以下值:-Xms512M -Xmx1024M。通过此修改,我能够让我的激活器重新启动并运行。
猜你喜欢
  • 2014-02-28
  • 2013-01-17
  • 1970-01-01
  • 1970-01-01
  • 2017-05-04
  • 2013-11-04
  • 2023-03-18
  • 2020-11-26
相关资源
最近更新 更多