I’m not sure if this is a bug, nevertheless I don’t have access to bug reports.
local players = {}
setmetatable(players, {__mode = "kv"})
game.Players.PlayerAdded:Connect(function(p)
players[p] = true
end)
while true do
for k, v in pairs(players) do print(k, v) end
wait(5)
end
Kiansjet
(Kiansjet)
April 10, 2018, 8:52pm
#2
Am I missing something? It’s a player ofc it’s not gonna get garbage collected lol.
TaaRt
(TaaRt)
April 10, 2018, 8:53pm
#3
This is how you can access bug reports as New Member.
yes once i leave the reference to the player still exists
i guess the new member role is completely pointless then
(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)
acreol
(awe)
April 10, 2018, 9:02pm
#7
You’ve unintentionally leaked an implementation detail of the engine—The way that the engine keeps track of Ref[Instance]s so that it can give you back the same reference every time is by storing them in a weak table. Thus, if the only reference you have to a Ref[Instance] is itself in a weak table then all of the references to it are in weak tables and it will get collected.
There’s no easy way to fix that either. That registry of Ref[Instance]s needs to be weak in order for the C++ side to kn…
This should help explain your issue for the instances (players in your case) but why would you want weak values?
1 Like
The issue is that it isn’t being gc’d.
Kiansjet
(Kiansjet)
April 10, 2018, 9:34pm
#9
If it were GC’d the object may be unintentionally destroyed
Again, the problem is that it isn’t being gc’d when there’s no longer a reference to the player.
Kiansjet
(Kiansjet)
April 10, 2018, 9:42pm
#11
And I just gave you a reason why that isn’t a problem.
The problem is that the instance still isn’t being gc’d when it no longer exists, thus a memory leak. If you can’t understand that then you should probably stop replying to threads you don’t know jack about.
1 Like
Kiansjet
(Kiansjet)
April 10, 2018, 9:47pm
#13
It’s a player. It’ll get gc’d once the player leaves don’t worry lol.
Sidenote: pls respect your peers
5 Likes
THE PROBLEM IS IT ISN’T GETTING GC’D ONCE THE PLAYER LEAVES, hopefully you can read that :).
respect bro
5 Likes
Kiansjet
(Kiansjet)
April 10, 2018, 9:53pm
#15
@Acreol gave you the straightforward most answer. Read that post he quoted.
If you’ve read the post you’ll know that the solution to the problem is literally the exact opposite of what’s happening here. It’s saying how instances are gc’d in a weak table, however that’s not happening here, if you bothered to read any of my past replies you’d understand that ( ).
This is better suited in bug reports honestly.
Can someone post this on bug reports instead of trying to prove me wrong without any idea of what’s going on here?
Kiansjet
(Kiansjet)
April 10, 2018, 10:01pm
#18
@TaaRt already posted a quote answering that question too lol.
Respectfully, can someone who knows what they’re talking about respond or post this in bug reports please?
2 Likes
Kiansjet
(Kiansjet)
April 10, 2018, 10:09pm
#20
That’s
Not
The
Process
If anything you’re worsening your chances with every post