Pathfindservice memory not lowering

Pathfindservice memory doesn’t lower at all, when the paths get deleted, or when the scripts containing them get deleted.
The code provided is used in the pathfindingservice api reference. PathfindingService | Documentation - Roblox Creator Hub

local Workspace = game:GetService("Workspace")
local PathfindingService = game:GetService("PathfindingService")

-- This model contains a start, end and three paths between the player can walk on: Snow, Metal and LeafyGrass
local PathOptionsModel = script.Parent.PathOptions
local startPosition = PathOptionsModel.Start.Position
local finishPosition = PathOptionsModel.End.Position

-- Create a path that avoids Snow and Metal materials
-- This will ensure the path created avoids the Snow and Metal paths and guides
-- the user towards the LeafyGrass path
local path = PathfindingService:CreatePath({
	AgentRadius = 3,
	AgentHeight = 6,
	AgentCanJump = false,
	Costs = {
		Snow = math.huge,
		Metal = math.huge,
	},
})

-- Compute the path
local success, errorMessage = pcall(function()
	path:ComputeAsync(startPosition, finishPosition)
end)

-- Confirm the computation was successful
if success and path.Status == Enum.PathStatus.Success then
	-- For each waypoint, create a part to visualize the path
	for _, waypoint in path:GetWaypoints() do
		local part = Instance.new("Part")
		part.Position = waypoint.Position
		part.Size = Vector3.new(0.5, 0.5, 0.5)
		part.Color = Color3.new(1, 0, 1)
		part.Anchored = true
		part.CanCollide = false
		part.Parent = Workspace
	end
else
	print(`Path unable to be computed, error: {errorMessage}`)
end

Even once the path is destroyed and set to nil, the memory does not lower.

System Information: Intel i9-12900KF, 64 GB, NVIDIA GeForce RTX 4090 OC

Expected behavior

The memory should lower, or return to 0 once all references to pathfindingservice is removed from the game.

A private message is associated with this bug report

1 Like

Firstly, this isn’t a Cloud Services Bug, it’s an Engine Bug. Cloud Services are things like external web APIs.

Secondly, have you given it a few minutes to garbage collect before checking the memory? None of this happens instantaneously, I don’t believe.

1 Like

Apologies for categorizing improperly roman. Anyways, could you provide a clip of the garbage collection working after a few minutes?

1 Like

I don’t have the time for that, but a quick Google search shows it:

If it’s not cleaned up after a few minutes, this may still be a bug

Thanks for the report. We will investigate.