summaryrefslogtreecommitdiff
path: root/src/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lgc.c')
-rw-r--r--src/lgc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lgc.c b/src/lgc.c
index 87a3b534..9259bff0 100644
--- a/src/lgc.c
+++ b/src/lgc.c
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.c,v 2.18 2004/12/06 17:53:42 roberto Exp $
+** $Id: lgc.c,v 2.19 2004/12/13 12:15:11 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -27,6 +27,7 @@
#define GCSWEEPMAX 10
#define GCSWEEPCOST 30
#define GCFINALIZECOST 100
+#define GCSTEPMUL 8
#define FIXEDMASK bitmask(FIXEDBIT)
@@ -621,18 +622,17 @@ static l_mem singlestep (lua_State *L) {
void luaC_step (lua_State *L) {
global_State *g = G(L);
- l_mem lim = (g->totalbytes - (g->GCthreshold - GCSTEPSIZE)) * g->stepmul;
+ l_mem lim = (g->totalbytes - (g->GCthreshold - GCSTEPSIZE)) * GCSTEPMUL;
do {
lim -= singlestep(L);
if (g->gcstate == GCSpause)
break;
} while (lim > 0 || !g->incgc);
- if (g->incgc)
+ if (g->gcstate != GCSpause)
g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/STEPMUL; */
else {
lua_assert(g->totalbytes >= g->estimate);
- lua_assert(g->gcstate == GCSpause);
- g->GCthreshold = 2*g->estimate;
+ g->GCthreshold = g->estimate + ((g->estimate/GCDIV) * g->gcpace);
}
}