我最近在运行 Grails 应用程序时遇到以下错误,该应用程序实际上是由 cron 触发的quartz作业(当前附加到 Controller 进行开发):
2014-11-21 12:37:34,538 [quartzScheduler_Worker-1] 错误listeners.ExceptionPrinterJobListener - 作业中发生异常:Grails Job 消息:java.lang.OutOfMemoryError:超出 GC 开销限制
我想增加堆空间,但我不确定我的 grails 版本(2.2.4)的正确方法。
我应该创建 GRAILS_OPT 环境变量还是使用 grails.project.fork?
请您参考如下方法:
我假设您需要更改这些设置以进行开发,并且可以使用 GRAILS_OPT 环境变量来完成此操作。有关如何执行此操作的信息,请参阅适用于您的操作系统的说明。
来自 Grails documentation :
It's often useful to provide custom arguments to the JVM when running Grails commands, in particular with run-app where you may for example want to set a higher maximum heap size. The Grails command will use any JVM options provided in the general JAVA_OPTS environment variable, but you can also specify a Grails-specific environment variable too:
export GRAILS_OPTS="-Xmx1G -Xms256m -XX:MaxPermSize=256m"
grails run-app




