Significant memory leak on blank baseplate when resetting character

I was doing some research into a project’s poor memory performance by testing stuff on a blank baseplate, and found that Instances, PhysicsParts, and Animation are leaking a significant amount of memory every time a character loads. You can reset several times, then leave the game, and that memory will never be released.

Here you can see me resetting my character several times, then leaving the game entirely. Memory for this category hangs higher than where I started resetting and never drops back down.

This is reproducible on a blank baseplate, both in Studio and in a live game.

This is causing significant problems for my experience, as servers can start reaching RAM usage nearing 6GB+ after 10 hours and hundreds of users.

EDIT 5/1: After applying the destroy character fix (code below) and fixing a number of leaks that were my own fault, servers should theoretically be lasting 55-60hrs+ before crashing out due to an overload of PhysicsParts. It remains to be seen whether the remaining PhysicsParts memory is due to a leak of my own making, or is leftover from the issue reported here.

 local players = game:GetService("Players")
 
 players.PlayerAdded:Connect(function(player)
 	player.CharacterRemoving:Connect(function(character)
 		character:Destroy()
 	end)
 end)

15 Likes

Possibly related:

1 Like

Thanks for the report! We’ve filed a ticket in our internal database.

7 Likes

I think this issue may be related to my game as well : Every time a new unique character mesh loads in it leaks memory (200-300 MB) - #7 by romeoduncan

1 Like

Do you know any short term solution we can use to resolve this issue because it is really stunting my games growth?

1 Like

If your game doesnt depend on players showing their avatars off, you can override with a custom character model, thats what i did

Hello, just wanted to let everyone know that you can patch this issue by destroying the character on the character removing event as highlighted in this post : On player load PhysicsParts memory increases permanently, resulting in crashes and severe lag

1 Like

I did some initial tests with this bandaid on a blank baseplate and the results show it might be helping. I’m waiting on some data to populate after I pushed the patch live last night to see for certain how much it helps in practice.

1 Like

While it does help, its certainly not enough. There’s still noticeable lag.

1 Like

This fix shaved about 10-15% off of my total memory usage, maybe a little more if you factor out UntrackedMemory, and it was basically free. Good find! :+1:

2 Likes

Let’s hope it’s fixed by Roblox themselves soon.

1 Like

Has there been any update on this?

2 Likes

From the looks of the screenshot below, not anything good I can think about.

There’s also nothing but a baseplate in this game and I didn’t even reset my character at all, so this kind of unneeded high memory usage is just unacceptable at this point.

I can’t even work on any projects without worrying about my low-end computer blowing a fuse over something simple in Studio, so hopefully this gets resolved quickly.

3 Likes

hi, animation, physicsparts and instances are still leaking server-side memory on a blank baseplate, despite setting PlayerCharacterDestroyBehavior to true. Manually destroying the character on CharacterRemoving doesn’t work either.

My biggest concern is with animation, as a character could be loaded up with a bunch of animations that takes up a lot of memory, and dying a bunch of times on top of that means memory leaked = # animations loaded * # times character reset, you can see how fast that can add up.

In my tests, server side animation is consistently the fastest rising stat in memory usage.

3 Likes

Reading this makes me think this covers the same issue: