It seams that local scoped variables are not being correctly gc-ed when they are not longer used, thus memory just keeps growing.
Example:
When using stock/vanilla Lua 5.1 following code yields this:
local d = {}
do
local a = {}
local b = 1
d['a'] = a
d['b'] = b
end
for k, v in pairs(d) do
print(k, v)
end
collectgarbage()
print("=====================")
for k, v in pairs(d) do
print(k, v)
end
a table: 0x006b8638
b 1
=====================
b 1
While in docker the same code does not release the local scoped variable and yields this.
2023-05-24 11:58:13 a table: 0xc0012a4000
2023-05-24 11:58:13 b 1
2023-05-24 11:58:13 =====================
2023-05-24 11:58:13 a table: 0xc0012a4000
2023-05-24 11:58:13 b 1
I managed to track same issue in gopher-lua it was fixed but same changes i haven’t seen in nakama pull.
Local Memory Scope GC
collecgarbage is implemented in nakama, and it clears whole memory of Go rather than just Lua VMs
So i am not 100% sure , should in nakama case locally scoped variables be gc-ed or not, but anyway reporting it for clarification.
- Versions: Nakama {3.16.0}, { Docker},
- Server Framework Runtime: Lua