How to solve OutOfMemoryError on Minecraft server?

Start by reading the OutOfMemoryError type. Java heap fullness, local memory issue, and process terminating from hosting limit are not resolved in the same way.

Step by step

  1. Get the actual error text at the end of the log. Distinguish between Java heap space, unable to create native thread and 137 exit code on the panel.

  2. Compare the initial -Xmx value and the panel memory limit. Leave space for memory used by Java and plugins outside of heap.

  3. If the heap is constantly growing over time, investigate the world, player load, and recent plugin changes where the issue occurs. Perform memory analysis in a controlled environment.

  4. After a change, observe again at normal intensity. Check how process memory, heap and disk swap behave individually.

Keep in mind

Heap dump may contain player or configuration data. Sharing publicly.

Source and tools