Humanoid:ApplyDescription() causing memory problems

After a day or so of testing and messing around trying to find what’s causing me memory problems, I have deduced the line that’s the cause of all problems.

-- This function fires when player clicks a button
local function Update(player, category, item)
	local Character = player.Character
	if not Character then return end
		
	local HumanoidDescription = Character.Humanoid:GetAppliedDescription()
	
	UpdateHumanoidDescription(player, HumanoidDescription, category, item)
	
	--Character.Humanoid:ApplyDescription(HumanoidDescription)
	
	HumanoidDescription = nil
end

As you can see, I’ve commented out the line. When that line is commented out, everything works fine, no memory problems, even if I click on 100-150 accessories. Obviously tho, the accessories aren’t being added to the player tho. So

Character.Humanoid:ApplyDescription(HumanoidDescription)

Is what’s causing a massive memory leak in my game.
DEFAULT MEMORY


MEMORY AFTER APPLYDESCRIPTION IS RUN 100+ TIMES

Both memory, and CPU get used up a ton

I don’t think that Humanoid:ApplyDescription() is causing this at all. Since you said in a comment in the script that is in a function that fires when a player clicks a button, I’m almost certainly sure that the memory leak lies within the event rather the ApplyDescription function.

I recommend reading on this article, since it talks about measures and precautions you can do to avoid this.

I don’t see how it can be anything else tho. If I comment out the line, everything runs smooth. If I remove the comment, that’s when problems arise, so it has to be that line

If you believe your code is fine you could make an engine bug report that Humanoid::ApplyDescription is causing a memory leak.

I would but then they want repro and what not, and it just takes up more time trying to setup a repro and what not