Why does my game’s servers lags a lot/is unplayable when I let servers run for a while (until I reset the servers). I have lots of active players in my game, and when it lags/is unplayable it badly effects my game a lot. Memory leaks/untracked memory could be a cause but I already optimized all my code to avoid memory leaks. How can I fix this issue?
How can I double check if all code actually avoids any memory leaks? Or could something else be a cause?
Are those the stats for when you join a fresh server or a supposedly laggy server?
What’s the server memory on a laggy server?
But to answer your questions, there’s a lot you can do to bring down the place memory:
Reduce the amount of instances when possible
Reduce the size of images you’re using (just a single 1024x1024 image could be 7mbs!)
Look for any cases where a part, model, or other instance is not getting destroyed when it should
For untracked memory, it’s just that, untracked. It’s a lot harder to scope down where it’s coming from, but typically they’re just non-garbage collected instances or values (like tables). Sometimes it could even come from Roblox core components. You really wont know unless you know everything about your code! (and I literally mean everything).
I have a small map, and there are no lingering parts/models made from script(s) (As I already optimized all scripts to avoid this.) I made a script that counted the amount of parts in workspace and there were thousands for some reason. Im going to double check my small map but that seems very odd.
If your place memory is increasing then you haven’t optimized everything yet. There’s still instances being left around either in workspace or nil, stagnant until removed by your code.