1

I've got a running sbt project that can start my server using re-start. The setup was done using the xsbt-web-plugin.

Now I noticed that the server process runs with a heap of 128M which is a little short. I know how to configure the heap size for the sbt process, but apparently spray is running a different jvm.

How do I configure a larger heap for spray-can in this kind of setup?

Details

I've configured my sbt like I answered here: How to specify JVM maximum heap size "-Xmx" for running an application with "run" action in SBT?

BUT when I look at the running processes with jconsole I can see that the server process is running in a different jvm:

jconsole shows different process for server next to sbt-launch.jar

And I can see that this process has a heap of only 128M instead of the 3.5G I configured in .sbtconfig.

jconsole shows this process has only 128M memory

Community
  • 1
  • 1
iwein
  • 25,788
  • 10
  • 70
  • 111
  • Maybe one of the suggestions here: http://stackoverflow.com/questions/3868863/how-to-specify-jvm-maximum-heap-size-xmx-for-running-an-application-with-run – jcern Jan 26 '13 at 22:41
  • thanks @jcern I looked at those, but they modify the sbt jvm; not the jetty jvm. – iwein Jan 27 '13 at 08:01
  • are you sure that http://stackoverflow.com/a/3870572/1408096, or http://stackoverflow.com/a/7430656/1408096 won't help? nothing else is coming to my mind ... – xhudik Jan 28 '13 at 10:58
  • I didn't fix it with those answers (possibly bad reading skills on my part). See my answer below. – iwein Feb 12 '13 at 17:50

1 Answers1

0

It is possible to fix this by setting the javaOptions for forked JVMs

object BuildSettings {
   ....
   val buildSettings = Defaults.defaultSettings ++ Seq(
     ....
     javaOptions += "-Xmx1G"
     ....
  )
}

If you want to be more particular about different processes you can use something like

javaOptions in run +="-Xmx1G"

But I haven't found which value you should pass to in yet.

iwein
  • 25,788
  • 10
  • 70
  • 111