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