Typically, a server will attempt to allocate as much memory as it will need to use, then internally free up space as needed. This shows up on the panel as a big chunk of memory being used, but that's normal! It's like taking a slice of cake, you wouldn't eat from somebody else's slice, right?
However, if you notice your server being either forcefully stopped or being terminated without a log message in the console or a crash report mentioning why this could be the case, the server's memory allocation might be running over your plan's memory limit. This could be caused by process overhead (disk access, network operations, etc.) that disregard the memory limit, memory leaks from poorly-written mod code, or rapid memory allocation caused by chunk generation and loading.
To fix this issue, we recommend lowering the Xmx value in your server's startup command by 200 to 300 MB to give extra room for this overhead if you experience these crashes.
Adjusting your startup command
Adjusting your startup command on your server can vary across different loaders. You can find the relevant sections to do this for your loader below.
Fabric, Bukkit-based, and Vanilla servers
To adjust the server’s startup command on Fabric, Bukkit-based servers (Paper or Purpur), or the vanilla server software, follow the steps below:
Head to the server's settings (cog icon in the top-right).
Once that has been opened, head to the Advanced tab on the sidebar.
Under the Startup command section, you should see an input box to adjust the startup command for your server. If I wanted to set the
Xmxvalue to5700M, or 5.7 GB, I would put-Xmx5700Mbefore the-jarflag in the input box, like in the image below.Make sure to click the "Save" button on the menu below, and restart your server to apply the changes you just made.
NeoForge or Forge Servers
To adjust the server’s startup command on NeoForge or Forge servers, follow the steps below:
Head to the Files tab of your server panel.
Find the
user_jvm_args.txtfile in your list of files, and open the file by left clicking onto it.Once the file has been opened, you should see some comments about how to set the maximum and minimum memory for your server. In this case, if I wanted to set the
Xmxvalue to5700M, or 5.7 GB, I would put-Xmx5700Min a new line in the input box, like in the image below. If you want to add more startup commands, create a new line and add each one individually below each other.Make sure to click the "Save" button on the menu below, and restart your server to apply the changes you just made.
Continuous Crashes
If your server continues to crash in the same way with no crash log generated, then you'll have to lower the Xmx value further. It may take a few tries to find your server's sweet spot, as it's not easy to estimate how much overhead your server will need to use. Every time the server is terminated, lower the value by a couple hundred megabytes and restart the server. The value also could've been reset if you recently upgraded your server plan or updated/changed platforms!
