lua-users home
lua-l archive

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

> When I call lua_newthread under low-memory conditions the Lua allocator
> might fail. I've found that this causes Lua to panic. 
> I think that lua_newthread should return null rather than crashing hard.
> After all, Lua was designed to work with small memory footprints.
> Is there a reason why lua_newthread can't fail gracefully? Is the internal
> state corrupted is some way that can't be recovered from?

lua_newthread behaves (or should behave) like any other API call: It
raises a regular error in case of an allocation error. What causes the
panic (probably) is that your code is running in unprotected mode, so
there is no proper error handler to get the error.

-- Roberto