Player instances aren't being GC'd in a weak table

I would like to experiment with this when I am home, however that will not be for another two hours.

Where exactly did you first notice this behaviour?

Also you’ve already been told that posting a bug report on your behalf will not happen, so stop insisting someone do so.

1 Like

It’s not like I can post a bug report with my status

And I tested this today

Answer the question for sanity’s sake please. How or where did you first notice this issue? Surely you didn’t magically start with this repro case. It will help determine if the repro case is faulty or if there is actually an issue impacting a project you’re working on.

2 Likes

I don’t know how that’s relevant, you’ll get the same results with an empty baseplate. Sure it doesn’t really have much of an impact but I posted here with the intention of it getting pushed up to bug reports.

It should be getting freed from memory but it isn’t.

I’ll admit this issue is fairly minor so I’m not going to continue

If you’re going to reject any troubleshooting or investigation efforts to ensure that this is actually an issue, then I don’t see why I should waste my time here. I will investigate this myself later if I have time.

Refrain from posting vague bug reports in the future if you’re just going to do this again.

5 Likes

Figure it out yourself if you refuse to answer people’s question man.
That article contains the info you need.
Look at that line,

http://wiki.roblox.com/index.php?title=Weak_tables#Weak_Keys

3 Likes
local players = {}
setmetatable(players, {__mode = "kv"})

game.Players.PlayerAdded:Connect(function(p)
	players[Instance.new"Part"] = true
    players[p] = true
end)

while true do
    for k, v in pairs(players) do print(k, v) end
    wait(5)
end

After joining the game the output shows “Player1 true”, which implies the part I create in PlayerAdded does get GC’d. If I had to guess, after a player leaves the object is parented to nil but a reference to it still exists elsewhere, perhaps internally by the engine or somewhere in a corescript?

Not sure.

4 Likes

It’s possible that a CoreScript is memory-leaking references to players

3 Likes

I decided not to reply to you because its an easily reproducible issue, test it I’in an empty baseplate and you’ll get the same result.

Is this in a LocalScript? I don’t think LocalScripts can ever see the LocalPlayer getting gc’d.

Man I hate when my roommates don’t take out the garbage and you have to do it yourself, and this feels strikingly similar.

5 Likes