ArrayIndexOutOfBoundsException when setting entries on weak tables
migeyel opened this issue · 3 comments
Minecraft Version
1.20.x
Version
1.109.4, 1.109.5
Details
The following code errors pretty reliably when it shouldn't:
local t = setmetatable({}, { __mode = "k" })
for _ = 1, 1e6 do t[{}] = {} end
This looks like a regression. I'm not able to reproduce it on 1.109.3.
I seem to remember that weak tables are not implemented, there are a few things with memory management/garbage collection that PUC Lua provides but Cobalt (and thus CC) doesn't due to how Cobalt is implemented on Java.
Weak tables are implemented, they just have somewhat broken semantics. No, this is a recent regression caused by cc-tweaked/Cobalt@5aebd88.