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?
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:
And I can see that this process has a heap of only 128M instead of the 3.5G I configured in .sbtconfig.
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.