lua-users home
lua-l archive

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


> My reply was about Roberto's suggestion to "forbid any GC operation while
> running
> a finalizer"
> If GC inside a finalizer is disabled, then simple operation "t.x=1" might
> raise OOM.

Did anyone in this discussion bother to see how Lua is today?  Run
the following program in any version of Lua since 5.2:

setmetatable({}, {__gc = function ()
  for i = 1, 1e8 do
    if i % 1e6 == 0 then
      print(collectgarbage("count") * 1024)
    end
    local a = {}
  end
end})

collectgarbage()
print("ok")


-- Roberto