aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lgc.c b/lgc.c
index 5823cb6b..22d36aed 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.204 2015/03/04 13:51:55 roberto Exp roberto $ 2** $Id: lgc.c,v 2.205 2015/03/25 13:42:19 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1114,9 +1114,12 @@ void luaC_runtilstate (lua_State *L, int statesmask) {
1114static l_mem getdebt (global_State *g) { 1114static l_mem getdebt (global_State *g) {
1115 l_mem debt = g->GCdebt; 1115 l_mem debt = g->GCdebt;
1116 int stepmul = g->gcstepmul; 1116 int stepmul = g->gcstepmul;
1117 debt = (debt / STEPMULADJ) + 1; 1117 if (debt <= 0) return 0; /* minimal debt */
1118 debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; 1118 else {
1119 return debt; 1119 debt = (debt / STEPMULADJ) + 1;
1120 debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM;
1121 return debt;
1122 }
1120} 1123}
1121 1124
1122/* 1125/*