Server memory in developer console not decreasing?

I’ve been watching the server memory usage in my game for a while, and with each server it seems to start at about 400mb but as players join and the server lasts longer it increases up to 1500. Now you may be thinking I have a memory leak in my code but there’s actually a few things going on here. Firstly, I created a type of diagnostic report system where in at any point that my server memory is high I can check the size of any non-garbage collected table I’ve initialized on the server. Consistent with the LuaHeap section of the developer console (which remains at about 13mb while the total memory increases), there doesn’t seem to be any tables holding on to references or holding large amounts of data. So then, I went through all my scripts and checked each connection, and all of them are properly disconnected.

The biggest issue, though, is with memory (allegedly) being consumed by RakNet and replicator under CoreMemory, and Instances and PhysicsPart under PlaceMemory. My game is very physics intensive, with lots of parts being simulated at once (generally increases with player count). So when the player count is peaking, 120mb and 180mb usage from RakNet and replicator respectively might make sense, as with the instances and physics memory; but, the problem is that even after EVERY player has left, and even if I clear every single child of every scriptable service (other than Players of course), it does not make a difference on these labels in the memory. The strangest part is that I would just think the dev console is frozen or something, but the memory usage of these labels do change slightly (either increase or decrease by tenths of a MB) every few seconds. However, like I said, even destroying every single instance in Workspace (which has 24 thousand parts) does not change the server memory at ALL. I’d guess this is a problem with deallocation, or maybe it is intentional devconsole behavior. Could anyone clear this up for me?

1 Like

I am also having this issue did you manage to find out what the problem was?

Nope but it doesn’t seem to cause an issue. Performance doesn’t seem to be impacted at all even in servers reaching up to 3000mb. Never had any issues with server crashes or slow game servers and the game has been running with ~2k players for months. If I were to guess, it is a visual issue. More realistically, some part of the API that I’m using in my code is probably causing Roblox to allocate all of this memory and it doesn’t end up being used. Annoying but seemingly harmless. Wish an engineer would’ve gave some insight though.