Any tips on finding a memory leak?

We run Minecraft inside a tmux session using a bash script to start it. tmux new-session -s server /home/mcserver/serverfiles/start.sh Link to the bash file: https://pastebin.com/raw/GbBd7sct The server has 8GB ram. Slowly overtime it uses more and more RAM until it consumes all of it and causes an OOM. It consumes more than is allocated to it. We tested this by allocating 4GB and it used up to 7GB. We have a lot of mods so I'm assuming one of them is causing a memory leak somehow? Is there any way or any tools that would help us find the culprit? Link to the mod list: https://pastebin.com/raw/4GCEbWV1 Server Info: OS: Linux VPS Distro: Debian 12 CPU: AMD Ryzen 7 5800X - 2vCPU @ 3.8 GHz RAM: DDR4 8GB Ram Storage: 120 GB NVME Thanks in advance!
13 Replies
Admincraft Meta
Admincraft Meta7mo ago
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by olliecrook#0
ProGamingDk
ProGamingDk7mo ago
dont use always pretouch its mc + jvm overhead
Eternal
Eternal7mo ago
try setting xms below xmx if you have a hard cap
Ollie
OllieOP7mo ago
I'll try both of this things ty! Generated the flags from https://flags.sh/ if there is somewhere else we should be doing it? I have applied both of those changes. I will leave the server running and see what happens 🙏
Eternal
Eternal7mo ago
do you have a hard limit on the server? the physical memory / ram limit on your server set by your host
Ollie
OllieOP7mo ago
8GB
Eternal
Eternal7mo ago
OS?
Ollie
OllieOP7mo ago
Debian
Eternal
Eternal7mo ago
linux/windows
Ollie
OllieOP7mo ago
linux Debian recommended is 512MB but I'm leaving 1.5GB for OS So far it seems to be doing the trick but the server has been idle. It should get played on again tonight so I'll report back again hmm no we're still having issues 😦
cal
cal7mo ago
https://spark.lucko.me/ run the profiler for a bit and show results
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Skullians
Skullians7mo ago
/spark profiler start --alloc
Ollie
OllieOP7mo ago
Awesome okay. That was going to be my next step anyway 👌

Did you find this page helpful?