lua-users home
lua-l archive

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


> Please consider the following code:
> 
> [...]
> 
> Output:
> 
> $ lua test.lua
> 27.6533203125
> 1058.3408203125
> 
> $ luajit-2.0.0-beta9 test.lua
> 23.71875
> 24.5673828125
> 
> 
> After a little investigation into what may occupy memory, I found that
> debug.sethook() leaves some internal data in the registry despite the
> corresponding coroutines have been collected. LuaJIT manages to free
> them as it probably should.

It is true. (Well, being more precise, the coroutines themselves are
never collected, because they are locked in the hook table.)  Lua 5.2
has the same problem. It seems that the hook table should have weak
keys.

-- Roberto