[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lua_pushstring, luaC_checkGC and top changing (grows by 2)
- From: Felipe Magno de Almeida <felipe.m.almeida@...>
- Date: Mon, 25 Jan 2010 18:41:58 -0200
Hi,
I'm seeing that when GCTM is called after a luaC_checkGC where the
threshold is hit, the lua_gettop(L) grows by 2.
This happens within GCTM where lua_gettop(L) == 0 and L->top is added by 2.
Then the luaD_call doesn't consume the two from L->top.
This only happens when the first GCTM is called.
All this happens while Lua is in a infinite loop.
A hook count is set every 2 instructions, and yields.
Everything is ran through a loop with lua_resume which every LUA_YIELD
it gets from a table indexed by a string.
Everything uses luabind in C++, and I can't really show the code that
happens this exactly.
But it is very obvious from running the debugger that after calling
lua_pushstring the lua_gettop(L) goes from 0 to 3, and this happens
because luaC_checkGC returns with lua_gettop(L) == 2 and then
lua_pushlstring increments the top after setting the string in the
stack.
This happens exactly after indexing the table 63 times. IOW, on the
64th iteration.
Any help would be appreciated,
Thanks in advance,
--
Felipe Magno de Almeida