Sbt (Scalatra building) goes down immediately with <2GB RAM

I installed the "Dropplet" / DigitalOcean server and gave it 512MB of RAM. when trying to run. / sbt script I get this failure immediately:

Using / root / .sbt / 0.13.0 as sbt dir, -sbt-dir to override.
VM warning on 64 bit OpenJDK server: INFO: os :: commit_memory (0x00000000a0000000, 1073741824, 0)> failed; error = 'Unable to allocate memory' (errno = 12)

# Not enough memory for Java Runtime Environment to continue.
# Initial memory allocation (malloc) failed to allocate 1073741824 bytes for memory reservation.

1073741824 bytes ~ = 1.07GB. If I remove it to 1GB of RAM it fails, but it works when I give the server 2GB.

I've seen similar questions, but all of the answers were okay "provide more space" ... but is that okay? Why does sbt require a lot of memory to be allocated instantly? It doesn't seem to matter when it is actually being built. Is it possible to change the size of the memory that sbt is trying to allocate?

+3


source share


2 answers


You can set the memory allocation pool limit by providing a parameter -Xmx

to the JVM. To do this, edit your sbt script as he said in the sbt docs . Another way is to set up swapping or add more RAM.



0


source


In the project file in the project sbt

directory (Scalatra) the parameter $default_sbt_mem

is set to 1536. You can change it depending on your server.



0


source







All Articles