[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1: debug.sethook() may cause leaks
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 16 Jan 2012 20:57:38 -0200
> > 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.
My "more precise" was wrong :) Lua does not use the coroutine itself
as the key, but the coroutine address (as a light userdata).
-- Roberto