[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: when a lua thread created from c can be release?
- From: Ketmar Dark <ketmar@...>
- Date: Mon, 13 Aug 2007 09:54:30 +0300
hello, 吕游 <firstname.lastname@example.org>.
On Mon, 13 Aug 2007 14:36:06 +0800
吕游 <email@example.com> wrote:
> garbage collection, like any Lua object". Problem is:I kept a
> lua_State pointer (for the newly created thread) outside the VM,and I
> have no way to tell VM when i don't need it.if the thread been
> sweeped as garbage,does the pointer i kept still valid? in other
> word,both my code and VM doesn't know when this thread will become
> really useless.
keep this pointer in registry.
> luaL_dofile(T,"test.lua"); after invoke lua_gc, this new thread
> pointer T still valid, and test.lua executed successfully. thanks
this is 'cause you must do 2 gc cycles to sweep the object. add second
call to gc and enjoy the bugs. %-)