summaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lapi.c b/lapi.c
index 93616244..be4449f8 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.159 2011/11/30 12:32:05 roberto Exp roberto $ 2** $Id: lapi.c,v 2.160 2012/05/11 19:22:33 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*/
@@ -1046,16 +1046,16 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
1046 case LUA_GCSTEP: { 1046 case LUA_GCSTEP: {
1047 if (g->gckind == KGC_GEN) { /* generational mode? */ 1047 if (g->gckind == KGC_GEN) { /* generational mode? */
1048 res = (g->lastmajormem == 0); /* 1 if will do major collection */ 1048 res = (g->lastmajormem == 0); /* 1 if will do major collection */
1049 luaC_step(L); /* do a single step */ 1049 luaC_forcestep(L); /* do a single step */
1050 } 1050 }
1051 else { 1051 else {
1052 while (data-- >= 0) { 1052 lu_mem debt = cast(lu_mem, data) * 1024; /* count in Kbytes */
1053 luaC_step(L); 1053 if (g->gcrunning)
1054 if (g->gcstate == GCSpause) { /* end of cycle? */ 1054 debt += g->GCdebt; /* include current debt */
1055 res = 1; /* signal it */ 1055 luaE_setdebt(g, debt);
1056 break; 1056 luaC_forcestep(L);
1057 } 1057 if (g->gcstate == GCSpause) /* end of cycle? */
1058 } 1058 res = 1; /* signal it */
1059 } 1059 }
1060 break; 1060 break;
1061 } 1061 }