aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-07-04 15:27:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-07-04 15:27:11 -0300
commit5298392c5ab452706b71a992b17e2a1bb2addde3 (patch)
tree3ff2bd57ea9e8e0a64b59e8c48105d20b9588941 /lapi.c
parent1ceec7437090bea4be7202b7f86e9d566e79f87f (diff)
downloadlua-5298392c5ab452706b71a992b17e2a1bb2addde3.tar.gz
lua-5298392c5ab452706b71a992b17e2a1bb2addde3.tar.bz2
lua-5298392c5ab452706b71a992b17e2a1bb2addde3.zip
bug: GC step could loop forever under very particular circumstances
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lapi.c b/lapi.c
index f76c6e61..7b679ef4 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.65 2008/02/14 16:02:58 roberto Exp roberto $ 2** $Id: lapi.c,v 2.66 2008/02/19 18:55:09 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -907,14 +907,14 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
907 } 907 }
908 case LUA_GCSTEP: { 908 case LUA_GCSTEP: {
909 lu_mem a = (cast(lu_mem, data) << 10); 909 lu_mem a = (cast(lu_mem, data) << 10);
910 if (a <= g->totalbytes) 910 g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0;
911 g->GCthreshold = g->totalbytes - a; 911 while (g->GCthreshold <= g->totalbytes) {
912 else
913 g->GCthreshold = 0;
914 while (g->GCthreshold <= g->totalbytes)
915 luaC_step(L); 912 luaC_step(L);
916 if (g->gcstate == GCSpause) /* end of cycle? */ 913 if (g->gcstate == GCSpause) { /* end of cycle? */
917 res = 1; /* signal it */ 914 res = 1; /* signal it */
915 break;
916 }
917 }
918 break; 918 break;
919 } 919 }
920 case LUA_GCSETPAUSE: { 920 case LUA_GCSETPAUSE: {