lua-users home
lua-l archive

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


Adam:

>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").<

How funny.  Again, this is almost exactly what I am doing.  I essentially
have "macro" files that scripts blindly load in order to be sure that
certain functions are available.  

I've moved away from this, however, as that does seem to eat up memory.
Theoretically, it should be GC'd, but perhaps somehow I still hold a
reference to it.  Not sure how that could be, but I guess it's possible.

Matt

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Adam Barnett
Sent: Wednesday, August 25, 2004 10:00 AM
To: Lua list
Subject: RE: Closing a VM (or "Root State") when running threads 

>> 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