lua-users home
lua-l archive

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


On 04.06.2005 at 14:10 Rici Lake wrote:

>On 4-Jun-05, at 1:55 PM, Andreas Falkenhahn wrote:
>
>>
>>
>> Hi,
>>
>> I noticed that the line that actually causes the crash is
>>
>> luaC_checkgc()
>>
>> which is a macro that calls luaC_collectgarbage() from time
>> to time. If I comment that line out, it does not crash any more.
>> But that does not really help me.
>>
>> If it's not allowed to call lua_pushstring or lua_newtable etc.
>> during the parser is active, is there any other way to store data
>> in the registry during script parsing?
>
>
>I assume this is Lua 5.0.2. I don't believe it is possible to do 
>anything which might trigger garbage collection during parsing, which 
>is why ChunkReaders are not able to actually use the Lua state.
>
>As I understand it, the Lua 5.1 parser is gc-safe, if that's any help.

Ok, thanks. My problem is, that I made many changes to this version
of Lua 5.0.2 so it would not be easy to skip to 5.1 now. 

What do you think of the idea to use some special versions of
lua_pushstring() and lua_newtable() which do not invoke the
gc? I mean, I do not need the garbage collector when storing data
in the registry because the data there should stay valid over the
lua state's lifetime anyway. There's nothing to be collected there.

>
>What I've done in order to get around problems like this (in 
>ChunkReaders, anyway) is create a completely separate Lua state, and 
>use that. Of course, in your case you would have to copy information 
>back from the scratch state; I guess it would depend on how much 
>information it was.

I could try that too, but the above idea sounds easier - if it could
be done that way.

Greets

Andreas
--
"Remember: It's nice to be important but it's more important to be nice!"