Every time your character dies it leaks memory (up to 500 MB, probably infinite)

We have identified the root cause of the issue and will hopefully ship a fix soon.

22 Likes

Is this related to humanoid / characters in general, or specifically only default characters spawned from LoadCharacter or the default respawn flow? Wondering if I will see an improvement in memory usage in my game about custom characters wherein I set player.Character directly.

The leak is only somewhat coincidentally related to avatar respawn. The bug was actually in one of our core Lua libraries we use for the core UI (in-experience menu, topbar, playerlist, etc.). It leaked a lot of memory on respawn due to one of our menus in the core script performing tear down and then setup again every respawn (a separate problem). This wouldn’t affect all games depending on how the custom characters are implemented. All games will probably see some memory improvement though.

28 Likes

Thanks for the elaboration! Great catch in that case.

2 Likes

It appears that respawning other people’s characters also leaks memory. (I can sit passively in many games and watch memory increase, unlikely caused by our code, but who knows).

Does this fix cover that scenario? Or should I submit a reproduction for better fixes?

There may be more than one memory leak! The memory leak we found would account for a certain amount of leaked memory in any game wether your character respawned or not but it shouldn’t really be dramatic.

Tomorrow, I will try changing your reproduction place to only kill players that are not me and join it on both my main and an alternative account. I’ll see if it leaks memory with and without my fix.

33 Likes

Hello! Has this shipped yet? Would love to start narrowing down any additional memory leaks across our games.

1 Like

There’s a substantial amount of logic that can not be pre-disabled when using

LoadCharacter()

When a player loads, the PlayerModule is required, and it instantiates. The problem is, this is a process that happens automatically, and can only be disabled by creating a custom character.

I propose the ability to disable logic that’s automatically replicated, such as the PlayerModule. This would allow us to make more modular characters, build off the default logic more efficiently, and have further control over our characters in general.

1 Like

This has not shipped yet, it is currently in QA. It should hopefully ship in the next two weeks.

12 Likes

Updating the thread again to say the change has passed initial QA and will release in Roblox version 541 barring any unforeseen issues.

For reference the current version is 539 and 541 will ship roughly 1.5 weeks from now.

You can follow the Release Notes category to know when a new Roblox version is released.

28 Likes

You’re a hero! Thank you so much for the rapid and quick communication.

4 Likes

hopefully a fix soon this is wreaking havoc on our player count since we reset everyone at the end of every 5 minute round

541 went live a couple days ago, was this fixed?

The fix is live, looks like there might be some other issue at play though. We saw an overall decrease in client memory usage with this fix but when joining the repro from this thread the memory still grows over time (although not as quickly as before). I’ll look into it.

10 Likes

Hi,
Is this issue still occurring? We recently released a memory leak fix in 544, and it appears to have resolved this issue. In the linked test place, I’m only seeing an increase of 40 MB of memory after 40 minutes (screenshot attached). Please let me know in this thread if this still reproduces on client version 544+.
Thanks!

Screen Shot 2022-09-20 at 5.51.15 PM

1 Like

I visited the test place for a short while. My memory seems stay at 100-110 MB range. Something has changed for the better. I didn’t check the effects on Task Manager though.

RobloxScreenShot20220920_220304552 (2)

1 Like

Quick side question: How come your memory shows at 266 MB, but if I join the game, it shows up as 462 MB? I’d really like back my 200 MB. :stuck_out_tongue:

image

My memory sits around 100 MB over about 2-3 minutes.

It looks like this issue was probably fixed for character death.

I’ve filed a new bug for character appearances leaking memory and updated the reproduction file. This means that while this specific bug can be closed, we’re still seeing crashes on low-end devices since players join with different appearances.

image

1 Like

If 100 MB are expected to be the gain over an hour, and total usage is suppose to be 450 MB, then I’m good to close this solution and mark this as solved.

Closing this since the original issue has resolved and a new topic has been created for the remaining issues discussed in this topic.