grails - 无法为对象堆保留足够的空间

时间:2016-02-11 17:29:25

标签: grails jvm

运行应用程序时出现此错误:

BUILD SUCCESSFUL
| Compiling 5 source files
| Compiling 5 source files.....
***
Metrics servlet injected into web.xml
Metrics Admin servlet-mapping (for /metrics/*) injected into web.xml
***
| Running Grails application
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 occurred. Program will exit.
| Error Forked Grails VM exited with error

我查看了堆栈上的相同错误并对内存进行了调整,但我仍然遇到此错误。我是Grails的新手,但我相信一切都设置正确,我可以运行一个示例应用程序(helloworld)。 以下是我所做的更改:

-Xms512m -Xmx1g -XX:PermSize=256m

这是记忆

free -m
             total       used       free     shared    buffers     cached
Mem:          2015       1297        718         56        169        859
-/+ buffers/cache:        267       1748

检查参数是否正在读取

$ ps -ef | grep java
tomcat7  32158     1  1 11:02 ?        00:00:10 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms512m -Xmx1g -XX:PermSize=256m -XX:MaxPermSize=256m -Xms512m -Xmx1g -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start

我在$ HOME / .profile

中有这个
export JAVA_OPTS="-Xms512m -Xmx1g -XX:MaxPermSize=256m"

在我的setenv.sh中用于Tomcat7

export CATALINA_OPTS="-Xms512m -Xmx1g \
    -XX:+CMSClassUnloadingEnabled \
    -XX:+CMSPermGenSweepingEnabled \
    -XX:+UseConcMarkSweepGC \
    -XX:MaxPermSize=256m"

我不确定现在要改变什么 - 似乎记忆力足够了?请任何想法都会很棒。谢谢

如果需要,忘记添加:

$ grails -version
Grails version: 2.4.5
$ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK Client VM (build 24.95-b01, mixed mode, sharing)

0 个答案:

没有答案