From 868ff40339fc72b7bf3c916afcdc2a992398346c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 29 Dec 2010 16:00:23 -0200 Subject: full collection does not restart collector + avoid changing GC state if an error happens in a step --- lapi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 73cf1108..9b824577 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.142 2010/12/20 18:17:46 roberto Exp roberto $ +** $Id: lapi.c,v 2.143 2010/12/20 19:40:07 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -969,7 +969,6 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { break; } case LUA_GCCOLLECT: { - g->gcrunning = 1; /* restart collector if stopped ?? */ luaC_fullgc(L, 0); break; } @@ -983,22 +982,19 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { break; } case LUA_GCSTEP: { - int running = g->gcrunning; - g->gcrunning = 1; /* allow steps */ if (g->gckind == KGC_GEN) { /* generational mode? */ res = (g->lastmajormem == 0); /* 1 if will do major collection */ - luaC_step(L); /* do a single step */ + luaC_forcestep(L); /* do a single step */ } else { while (data-- >= 0) { - luaC_step(L); + luaC_forcestep(L); if (g->gcstate == GCSpause) { /* end of cycle? */ res = 1; /* signal it */ break; } } } - g->gcrunning = running; /* restore previous state */ break; } case LUA_GCSETPAUSE: { -- cgit v1.2.3-55-g6feb