lua-users home
lua-l archive

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


> On Mon, 2 Mar 2009, Patrick Donnelly wrote:
> 
> > Using the attached script one can cause Lua to panic. The problem is
> > the API call lua_checkstack which may throw a memory error.
> 
> [snip]
> 
> > lua_checkstack should probably not throw memory errors because it
> > cannot knowingly throw the error on the currently running thread. The
> > thread you are checking stack space for may not actually be running!
> 
> Uhm.. sorry if I'm being dense, but isn't growing stack and possibly 
> throwing a memory error the very reason for calling lua_checkstack in 
> the first place?  What on earth is it supposed to do if it can't throw 
> memory errors when it can't grow the stack?

Probably a better correction would be to throw memory errors on the
main thread, if the current thread does not have one.

-- Roberto