lua-users home
lua-l archive

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


Hi,

I am using a debug build of Lua 5.3.5 which defines "lua_assert" to
"assert" from the cassert header. When I run the minimal working example
from the bottom of this mail, I am hitting the following assertion
(sometimes the program needs to run multiple times until the assert
condition is false):

Assertion failed: g->ephemeron == NULL && g->weak == NULL, file
D:\lua\src\lua-5.3.5\src\lgc.c, line 987

where g->ephemeron is NULL but g->weak is not.

Could someone tell me if the assertion is pointing to a real problem, or
if its maybe not a valid condition to assert for in the first place?

Many thanks,

Sascha


------- MWE start ------------

local function f()
  local weaktable = setmetatable({}, { __mode = "v" })
 
  return function()
    local row = weaktable[1]
    if not row then
      row = { a = 1 }
      weaktable[1] = row
    end
    return row
  end
end

for i=1,10000 do
  local t = f()()
end

------- MWE end ------------