Found a memory leak when cloning humanoids.
Repro script (which should be run as a localscript…)
while game.Players.LocalPlayer.Character == nil do wait(0.1) end
game.Players.LocalPlayer.Character.Archivable = true
local clone_proto = game.Players.LocalPlayer.Character:Clone()
game.Players.LocalPlayer.Character.Archivable = false
clone_proto.Parent = nil
clone_proto.Archivable = truewhile true do
local clone = clone_proto:Clone()
clone.Parent = game.Workspacelocal obj_character_desc = clone.Humanoid:GetAppliedDescription()
obj_character_desc.DepthScale = 0.5
obj_character_desc.HeadScale = 0.6
obj_character_desc.HeightScale = 0.7
obj_character_desc.ProportionScale = 0.8
obj_character_desc.WidthScale = 0.9
clone.Humanoid:ApplyDescription(obj_character_desc)wait()
clone:Destroy()
clone.Parent = nilprint(“Instances:”,game:GetService(“Stats”).InstanceCount, “Instance Memory:”, game:GetService(“Stats”):GetMemoryUsageMbForTag(Enum.DeveloperMemoryTag.Instances))
wait()
end
The humanoid description/scale stuff isn’t necessary (happens without those lines), but does make the memory leak go faster.
Place file:
clone_character_memory_leak.rbxl (53.2 KB)
Memory at start of run…
Memory after ~4 mins soak…
Instance count and memory usage continue to grow.
Expected behavior
Should not leak memory and/or garbage collect larger amounts more consistently.