Search code examples
windowsgroovyjvmgroovy-console

How to increase available memory size in GroovyConsole?


I'm running scripts inside GroovyConsole 2.4.5 on Windows 7 64-bit and they are crashing due to out of memory error. Runtime.getRuntime().maxMemory() shows 247MB and my PC has 32GB RAM. What is the way to increase memory available for GroovyConsole and underlying JVM?

I tried editing startGroovy.bat file with:

set GROOVY_OPTS="-Xmx2g -Xms1g"

and other values, but it had no effect.


Solution

  • I'm not on Windows, so can't test, but you should be able to use JAVA_OPTS instead of GROOVY_OPTS, ie:

    set JAVA_OPTS="-Xmx1G"
    

    Before you run groovyConsole