Make sure to see the full place file, but when you create a remote on the server and destroy it a bit after, the client doesn’t gc the references
As demonstrated in the last example of PSA: Connections can memory leak Instances!, this should not be happening
Here is the client side snippet:
local t={}
do
local checker=setmetatable({t},{__mode='v'})
coroutine.wrap(function()
while checker[1] do
print'exists'
wait()
end
print'gced'
end)()
end
local ev=workspace.RemoteEvent
ev.OnClientEvent:Connect(function()
_=t
end)
t.x=ev
ev.AncestryChanged:Wait()
print'c got kill'
Server side:
local ev=Instance.new("RemoteEvent",workspace)
wait(3)
ev:Destroy()
print("s destroyed")
Full place:
roblox broke.rbxl (13.1 KB)
Interestingly, if you manually disconnect the event on the client side when ancestry changes (bc no destroyed event ) it successfully gc-es
local t={}
do
local checker=setmetatable({t},{__mode='v'})
coroutine.wrap(function()
while checker[1] do
print'exists'
wait()
end
print'gced'
end)()
end
local ev=workspace.RemoteEvent
local disc=ev.OnClientEvent:Connect(function()
_=t
end)
t.x=ev
ev.AncestryChanged:Wait()
print'c got kill'
disc:Disconnect()