- Published on
Initialization Error in sbt
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
I use sbt (Simple Build Tool) as a project management tool for Scala.
Well, saying that I "use" it may be a bit generous. I only use it a little, mainly because it shows up often in samples.
My daily environment at the time was Ubuntu running inside a VM on a laptop, with about 1700 M of memory assigned to the virtual machine. In that environment, running sbt sometimes failed to start with the following error.
Error occurred during initialization of VM Could not reserve enough space for object heap
I had installed sbt through apt-get, and apparently the package version assigns 1536 M by default, which seems to be why it would not start. You can check the default memory amount in the -mem entry of sbt -h.
As a temporary workaround, you can start it by specifying the memory size explicitly at runtime.
sbt -mem 1024
I did not apply a permanent fix in practice, but I suspect changing default_sbt_mem in /usr/bin/sbt would solve it. Another option would be to create an alias that always adds the setting above.