Grails run-app必须执行两次

时间:2016-04-18 06:57:48

标签: grails

我必须两次运行start-app。在第一次运行时,我的控制台报告错误:

| Running application...
Error occurred during initialization of VM
Could not reserve enough space for object heap

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_77\bin\java.exe'' finished with
non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
| Error Failed to start server (Use --stacktrace to see the full trace)

但是在第二轮比赛中,它运行得很好。任何人都可以解释原因吗?

2 个答案:

答案 0 :(得分:0)

运行JVM with -XX:MaxHeapSize=512m(或任何大数字)(或简称-Xmx512m)

答案 1 :(得分:0)

在buildconfig.groovy中增加mxPerm和maxMemory的值

grails.project.fork = [
    // configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
    //  compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],

    // configure settings for the test-app JVM, uses the daemon by default
    test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
    // configure settings for the run-app JVM
    run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    // configure settings for the run-war JVM
    war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    // configure settings for the Console UI JVM
    console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]