lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I reproduced the ever-increasing memory behavior with a simple script.

local mt = {
        __gc = function() end
}
for i = 1, math.pow(10, 9) do
        setmetatable({}, mt)
        if (i % math.pow(10, 6)) == 0 then print(collectgarbage'count') end
end

In Lua 5.3.5, the memory grows to 1GB within a few seconds.
In Lua 5.2 and 5.4, it still grows to few MBs, but very slowly.
Setting the GC pause to 100 or less seems to solve this issue. Is this the correct solution?

--
Gabriel