[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible bug in Lua's Garbage Collector
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 29 May 2008 08:42:21 -0300
> showing this problem. I haven't been able to yet, however I did get
> some sort of memory leak while try to reproduce the above
I haven't tried to follow the logic of your example, but I don't think it
qualifies as a memory leak because if you call lua_close(L) at the end of
main then all udata are finalized. So, no memory is leaked.
Also, if you build Lua with LUA_USE_APICHECK on (just #define it in luaconf.h),
then you'll get an assertion raised very soon:
% ./a.out
Entering go
making userdata:0x805df2c
a.out: lapi.c:232: lua_pushvalue: Assertion `L->top < L->ci->top' failed.
This is raised by lua_pushvalue(L, 2) just after the loop that creates
tables So, it seems to me there's a stack overflow there. However, this
overflow is not the culprit because changing 1000 in luaL_checkstack to
1200 does not give the results you expected.
After a bit of digging, the problem seems to be that go leaves the
threads in the stack, and their memory is never collected. That's why
settop to 0 solves the problem.
--lhf