Reproduction Steps
How to reproduce:
Create a fresh baseplate.
Look at PhysicsParts and Instances Server memory usage.
Reset a couple times.
Look at memory usage again.
Issue has been occurring for about a year or so now. We did not isolate the problem until today after extensive testing. Our game is called SCP: Site Roleplay. It is a combat heavy game with lots of death. This bug causes servers to grow extremely unstable as they age and more players load/respawn. This eventually leads to the entire server crashing, but before that it affects all aspects of our game, mainly the movement of our SCP’s and doors not opening/closing correctly, etc. It is extremely detrimental to our player experience.
The AI will slow down and their walkspeed gradually decreases. The memory never stops growing. I sat and looked at it for almost an hour and did extremely intensive testing. I tried in 5 different places and the issue occurs in all of them. I had 4 of my staff members spam reset and respawn and the memory only spikes when they respawn, not when they die. It will attempt to stabilize and lower a little bit but it stays elevated permanently despite that and continues to do so until the server can’t handle it anymore and it just dies.
Expected Behavior
Memory should stay stable and not increase permanently or clean itself after a little bit of waiting.
Actual Behavior
Memory continues to rise permanently on character respawn/refresh/join.
First image is a fresh baseplate where I’ve done nothing except load in.
Second image is after resetting 5 times. The image clearly shows 5 different spikes and the memory did not budge from 1.910 until I reset one more time and it raised to 1.941.
Third picture is from our actual game. Had one of my mods run :refresh command like 10 times. You can see the huge spikes as he refreshes himself repeatedly. Then when he stopped the memory stayed stable and did not budge.
Fourth image is occurs right after the third one, I had all 4 of them spam refresh many times and it spiked by about 4 MB total as you can see.
Image 5 is when it tries to clean itself? I am not 100% sure how memory stuff works on Roblox so I apologize if my terminology is wrong here. But it clearly tries to do something then it stabilizes around 311.930-311.940 and does not budge until more people respawn.
Image 6 is an older public server (about 5 hours old) which you can see has very high memory usage.
KEY EDIT: Found a workaround after testing. It might not remove the issue 100% but the difference is night and day compared to before. With this script added the game actually attempts proper garbage collection and clears memory consistently. Add to ServerScriptService.
Script made by BananDev
> local players = game:GetService("Players")
>
> players.PlayerAdded:Connect(function(player)
> player.CharacterRemoving:Connect(function(character)
> character:Destroy()
> end)
> end)
Issue Area: Engine
Issue Type: Performance
Impact: Very High
Frequency: Constantly
Date First Experienced: 2021-12-01 00:12:00 (-06:00)
Date Last Experienced: 2023-01-01 00:01:00 (-06:00)
A private message is associated with this bug report