Servers crashing, possible memory leak

Servers are crashing in my game after being alive for around 8 hours. I assume this is due to a memory leak because the server memory is slowly building up to 4 GB of memory and crashing.

Here are some screenshots of the memory at the game after the server has been up for 8 hours:


First off, UntrackedMemory is the highest memory by far and it just so happens to be “Untracked” so I don’t know what, if anything that I can do about it. I also thought it might be a script causing the memory leak but my LuaHeap never goes above 200 MB, which indicates to me that a script does not have a memory leak within. Even though UntrackedMemory is so high, it’s not even half of the entire memory usage in my game! The rest of the memory is spread pretty evenly throughout everything else in CoreMemory and PlaceMemory, so there’s no specific location I can look at and make the assumption that it’s coming from a specific location.

I feel since UntrackedMemory is the highest, maybe solving that will solve the rest of my issues, my only problem is the fact that it’s Untracked and I have no Idea what I can do about it. If anyone has any ideas or knows what could cause UntrackedMemory to be so high, please let me know.

Server crashing below:

1 Like

Have you tried checking out ‘Scripts’ or ‘ServerJobs’ seeing if anything is running at an unusually high percentage?

Yes, all scripts are very low in % activity and rate/s.

What goes on in your game? What are all the various server tasks that occur?

It’s a very large amount of things that are taking place, I couldn’t answer specifically what my game does. Why are you asking? Maybe I could provide better info if I knew what you were looking for.

With very minimal information, I have no idea how or what is causing the lag spikes.

It does sound like a memory leak indeed. Unfortunately I do not know of a good way to track memory leaks in LUA so I will subscribe to this thread for possible solutions.

Depending on how big your game is and how many scripts you have, it could be very very hard to track it down. My suggestion would be to disable all scripts and then reenable them 1 by 1 to see which cause the leak. However, if it takes 8 hours to observe the leak then that will be very hard.

A common place to leak memory is in tables that keep player information. Make sure such tables have keys associated to disconnecting players deleted. In general the easiest way to leak memory in lua is within tables cause in any other way the memory will get garbage collected automatically.

Best of luck and I hope Roblox develops some solid tools so we can see which scripts leak memory where.

1 Like

Is this with or without StreamingEnabled? Been having a couple issues with it that I’m trying to resolve too in terms of memory.

Okay, what information should I provide that will make it easier to diagnose?

There are many other common ones like connections, creating new threads, local variables. Unfortunately, the memory is untracked and I don’t even know if it’s coming from a script. Usually when a memory leak is coming directly from a script’s memory usag, LuaHeap would be unbelievably high but it never goes above 200 MB. Unless I am wrong about LuaHeap, that is.

StreamingEnabled is not set to true in my game.

1 Like

I went in to a server and disabled every single server script, the server memory did not change.

I also went into a server and deleted every part in workspace except for a single baseplate, the memory did not change.

I don’t know what else is left to do, I can’t seem to find the solution to this problem.

Even worse is, the memory shows up in different locations each time. This time one of the servers barely had any untracked memory, 5.7 GB of memory were split evenly between CoreMemory and PlaceMemory unlike before where 2 out of 5 GB of it were crammed into UntrackedMemory.