lua-users home
lua-l archive

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

> Yes.  You see, a coroutine is just an object itself.  When no
> references to it remain, it will be collected sooner or
> later, just like any other unreferenced object.

The way I deal with this is to simply store a reference to the thread in
the registry. Then when I am finished with the thread I set that
reference to nil. I am pretty sure this is the standard way to manage
threads and coroutines created from C.

Actually I'm not creating *any* other states or coroutines from C,
only single main lua_State. However I'm holding reference to one root
coroutine, created from Lua. And I had not stored any other Lua
references to it -- passed it to C-function and nothing more.

I've assigned this coroutine to global Lua variable. The crashes are still here.

Is there any method to debug GC crashes except that trying to randomly
guess which Lua object got collected?