Memory Leak Help: Player leaves and memory increases, player rejoins and it decreases back

I am currently trying to eliminate a new memory leak in my game. In doing so, I discovered that when a player leaves, the server memory (specifically UntrackedMemory) increases 4-5mb. When that same user rejoins the server, the server memory decreases by the same amount and back to what it was before.

Considering the eventual stack of memory as players come and go in various servers over time, this HAS to be the problem.

With that said, what scenario would cause this?

I have already read other similar dev-forum posts, but they were old and did not offer any solutions.

2 Likes

There are some connections to objects within the player, but I delete the player object after their data is saved anyway which includes those objects.

After looking through my code again, every reference to the player appears to be set to nil as it should.

1 Like

Hey, have you found a solution? I have the same problem and it’s driving me bonkers. From my testing I have narrowed it down to the PlayerGui getting dumped onto the server when they leave the game. I’m curious to know if you remove all Screen Gui’s from your game and test again if Server Untracked Memory continues to rise.

After reading everything I can find about memory leaks and disconnecting , etc, trying various things to fix it, with no positive results. I decided to try a base plate with nothing in it and even there the Server Untracked Memory rises by 1mb when a player joins and leaves. I then made one ScreenGui and filled it with frames and uploaded an image and copied paste it 50 times in the frames. The Server Untracked Memory grew by 20mb when a player leaves, which i assume is the size of the Gui.

I believe this was a known bug previously thought to be fixed, but maybe its back?

Either way, if that’s your issue or not please follow up if you find a solution, I am super curious why this happens.

1 Like

I did not find a solution for the leak, but I also have not looked into their PlayerGui being dumped either. I did try the memory leak on an empty baseplate, and the leak persisted (but not to the same degree). I did try manually deleting the player instance after the player leaves thinking that would fix it, but it did not.

Thanks for the reply. I will look into their GUIs.

1 Like

2024 and still not fixed, thank you for describing exactly what is causing my memory leak