Roblox internal memory leak causes my game servers to undiagnosably crash every 3 hours

I read several other threads that described a similar problem. The memory leak seems to have something to do with character models being cached but the cache is never purged. Someone suggested adding this code to the server to help fend off the memory leak:

local playerService = game:GetService("Players")

playerService.PlayerRemoving:Connect(function(player)
	if player.Character ~= nil then
		player.Character:Destroy()
	end
end)

That supposedly forces the engine to destroy the character and purges the character appearance from the cache. Several individuals have said that it helps.

5 Likes

Iā€™ve tried this to no avail, unfortunately.


This bug report has been open for nearly two years - at this point Iā€™ve just accepted my game canā€™t be fixed as this is totally undiagnosable and absolutely destroying my userbase and retention. Iā€™m not sure what I can do to fix it anymore.

4 Likes

I reported this problem again, but with a different area of the leak, which also has a very big impact on performance.

This issue is still open, I will keep an eye on it and share everything I have

5 Likes

Pretty sure around may the touch event broke on the client and that could somehow be related which is unlikely

1 Like

Can confirm we are seeing this exact profile appear in our game too.

1 Like

Experiencing this as well. Unfortunately no way to pin it down; would love any and all help!

2 Likes

Same here. It just keeps rising.

This error ended up being caused by our datastore system. We were using a folder heirarchy - when a player joined, we would clone the folder structure, fill it with values, and make it accessible to the client via replicatedstorage.

Donā€™t use this method. We removed it (switching to a table structure stored on the server, made accessible to clients via remotes), and the issues vanished.

2 Likes

Im sure its been a very long while since you even thought about this problem, but are there any other workarounds? My game uses the same system, and recoding the entire game to fix this issue would be a massive painā€¦
Attached is what my data structure is
image

1 Like