lua-users home
lua-l archive

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


I managed to get rid of this problem by doing a garbage collect (
"lua_setgcthreshold(ls,0);" ) before I do "lua_close(ls)".

The manual says:
" To release a state created with lua_open, call        void lua_close
(lua_State *L);
This function destroys all objects in the given Lua environment (calling the
corresponding garbage-collection tag methods, if any) and frees all dynamic
memory used by that state. Usually, you do not need to call this function,
because all resources are naturally released when your program ends. On the
other hand, long-running programs - like a daemon or a web server - might
need to release states as soon as they are not needed, to avoid growing too
big. "

Lua doesnt seem to garbage collect before closing. Has something been
mentioned about this before, I vaguely remember something on the list but
egroups is down so cant look.

Cheers,
N


----- Original Message -----
From: Nick Trout
To: Multiple recipients of list
Sent: Monday, April 30, 2001 4:42 PM
Subject: collectstrings problem


Hi, I have a problem with Lua cleaning up on a lua_close(). I get p == -1
and a memory exception in collectstrings(). ie. the line "while ((next = *p)
!= NULL) {" in collectstrings. When I turn LUA_DEBUG on
"LUA_ASSERT(L->udt.nuse==0, "non-empty udata table");" fails in
luaS_freeall. I have no idea what this means :-). Please help! Both fns
enclosed.

Thanks, Nick