lua-users home
lua-l archive

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

(This is the second time I sent this message -- it never showed up on the list the first time, for me.  Apologies if this shows up multiple times)



Hi, I'm looking for some help figuring out a crash we're seeing in the garbage collection process.


We're using LUA 5.1 on the PS3 for game logic scripting.  We have already shipped games using this technology with no problems (Ratchet & Clank Future).  On our current project, however, we've run into an odd crash.  Whenever a specific script is loaded, the game will crash deep in the LUA garbage collection code.  The script in question is unremarkable -- it just creates a bunch of very simple tables in the form:


TableName = { Var1, Var2, Var3, Var4, <etc> }


... essentially just creating groups of userdata objects.  It also defines a handful of very simple functions.  It is possible that this script is not directly responsible, but is instead indirectly putting the LUA state into some odd condition.  If we don’t run the script, LUA runs fine. 


We are using a slightly modified version of LUA (floats instead of doubles) and a modified version of toLua for bindings (probably not relevant).  However, like I said, these systems have been used for a long time without this crash occurring.


I've ruled out app-side memory allocation problems with about 99% certainty (we have a lot of memory logging going on, and a ton of free memory for LUA to use).


Can anyone give me any hints as to what *might* cause this crash?  Any suggestions or clues will be helpful.  It seems at first glance that there is a table with a nil key, but I don’t know how that could possibly come into existence in the first place. 


Crash details:


---------------------this is the code-----------------------


X:\<snip>\lua\src\lgc.c line number 190


static int traversetable (global_State *g, Table *h) {




    else {

      lua_assert(!ttisnil(gkey(n))); // looks like we hit this assert

      if (!weakkey) markvalue(g, gkey(n));

      if (!weakvalue) markvalue(g, gval(n));



  return weakkey || weakvalue;



---------------------this is the callstack-----------------------


   Type   Function                                    

   int    traversetable(global_State * g, Table * h)  

   l_mem  propagatemark(global_State * g)             

   l_mem  singlestep(lua_State * L)                   

   void   luaC_step(lua_State * L)                    

   int    lua_gc(lua_State * L, int  what, int  data) 

   void   LUA::ScriptManager::CollectGarbage()        

   void   LUA::ScriptManager::Update() 


   int    main(int  argc, char ** argv)               






Andrew Yount

Lead Programmer, Insomniac Games