tags:

views:

68

answers:

3

My application does large data arrays processing and needs more memory than JVM gives by default. I know in Java it's specified by "-Xmx" option. How do I set SBT up to use particular "-Xmx" value to run an application with "run" action?

+1  A: 

There's one way I know of. Set the environment variable JAVA_OPTS.

JAVA_OPTS='-Xmx512m'

I have not found a way to do this as a command parameter.

Synesso
+1  A: 

If you run sbt on linux shell, you can use:

env JAVA_OPTS="-Xmx512m" sbt run

This is my usually used command to run my sbt project.

Googol Shan
+1  A: 

Try this:

class ForkRun(info: ProjectInfo) extends DefaultProject(info) {
    override def fork = Some(new ForkScalaRun {
        override def runJVMOptions = super.runJVMOptions ++ Seq("-Xmx512m")
        override def scalaJars = Seq(buildLibraryJar.asFile, buildCompilerJar.asFile)
    })
}
Arne