Get Asset Fetch Status Changed Signal shouldn't persist in memory forever

ContentProvider:GetAssetFetchStatusChangedSignal persists in memory forever after being called. I wanted to use this signal in my game to arbitrarily check the status of a bunch of assets and disconnect the signal once they are loaded. Specifically, in My Movie I wanted to check the time it takes to preload each asset individually (rather than as a whole like timing PreloadAsync). However, it looks like every time I use this signal I will add some bit of memory, so I will have to busy loop instead.

local ContentProvider = game:GetService("ContentProvider")

local i = 1000000

local connections = {}

script.Parent.Start.Activated:Connect(function()
	for _ = 1, 10000 do
		i += 1
		table.insert(connections, ContentProvider:GetAssetFetchStatusChangedSignal(`rbxassetid://{i}`):Connect(function() end))
	end
end)

script.Parent.Stop.Activated:Connect(function()
	for _, c in connections do
		c:Disconnect()
	end
	table.clear(connections)
end)

content connections.rbxl (79.5 KB)

Ideally this would clear the memory that GetAssetFetchStatusChangedSignal adds once the signals are disconnected, but it does not.

Neat–I didn’t know PreloadAsync took a callback function:

For each requested asset, the callback function runs, indicating the asset’s final AssetFetchStatus.

So this won’t actually block my use case.