Commits

Harald Klimach  committed a822b4e

Applied pach 2 for Lua 5.2.2
Garbage collector can trigger too many times in recursive loops.

  • Participants
  • Parent commits 3d8ac1e

Comments (0)

Files changed (1)

File external/lua-5.2.2/src/lgc.c

 
 
 static lu_mem traversestack (global_State *g, lua_State *th) {
+  int n = 0;
   StkId o = th->stack;
   if (o == NULL)
     return 1;  /* stack not completely built yet */
     for (; o < lim; o++)  /* clear not-marked stack slice */
       setnilvalue(o);
   }
-  return sizeof(lua_State) + sizeof(TValue) * th->stacksize;
+  else {  /* count call infos to compute size */
+    CallInfo *ci;
+    for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
+      n++;
+  }
+  return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
+         sizeof(CallInfo) * n;
 }