[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Closing a VM (or "Root State") when running threads
- From: "Adam Barnett" <adam@...>
- Date: Wed, 25 Aug 2004 16:00:00 +0100
>> The problem is that I want to be able to close the root state in order
>> to cause all the spawned threads to also end and be GC'ed. This
>> causes a fatal error (during what seems to be the "Sweep" functions in
>> LUA) when lua_close is called on the root state.
>
> This (closing a state with suspended threads) should work without
>problems, so it may be a bug. What version of Lua are you using? Can
>you give more information?
>
>-- Roberto
I'm using LUA 5.0.2 at the moment. I'm fairly sure the crash occurs in
"sweeplist" in lgc.c (I wanted to test for certain but the code is in a
broken state at the moment... sorry). A possible point was raised by
Matthew Harmon in another thread...
>Another thing I do, which is probably bad, is frequently redefine
functions.
>I'm not sure if that leaves the "old" code available for GC right away or
>not.
It was suggested in a reply that this would not cause problems as it would
still be GCed. I mention it again because I also frequently redefine
functions. Although this should be GCed okay, there might possibly be a bug
here. As far as I am aware, the function will simply be replaced in the
global table. In my code, this function is always the same function (i.e.
there are not 3 different functions in 3 different scripts all called
"Run").
Hope this helps,
Adam