Allocate More RAM to Minecraft Server
I have deployed a minecraft server but it only allocated 1024MB RAM even though my plan has 8GB RAM, so how do i allocate more to the minecraft server?
✓ Best Answer
You should set the
_JAVA_OPTIONS env var to exactly what I said previously.
That's a matter of adjusting the parameters used to launch the server. Typically, there is a script of some form that has a
java invocation in it. That invocation typically contains two options:
-Xms - which is the minimum memory allocation for java, and
-Xmx - which is the maximum
I would generally set the former to 2GB (
-Xms2G), and the latter to 7GB (
-Xmx7G), given a system with your specifications.
where shall i set these to ? I already set them to start.sh, bat and made a _JAVA_OPTIONS setting but still ./mcserver start won't pick up these and still starts the server with 1024MB allocated.
This is an example of how I have my start file setup.
#!/bin/sh java -Xms1024M -Xmx3328M -jar minecraft_server.1.17.1.jar
Note that your server might not use the memory it has available until you start exploring more of the world.
./mcserver start won't pick up my start file (start.sh) at all so i tried to use _JAVA_OPTIONS instead, then after it says:
Picked up _JAVA_OPTIONS: -Xmx:7100MB -Xms:4092MB
Invalid Maximum Heap Size: -Xmx:7100MB
Error: Could not create java virtual machine
Error: A fatal exception has been occured. program will now exit
The OS and java is 64 bit, but it didn't let me set the maximum heap size to 7100MB