aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldo.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index c563b1d9..a89ac010 100644
--- a/ldo.c
+++ b/ldo.c
@@ -245,13 +245,12 @@ static int stackinuse (lua_State *L) {
245 245
246void luaD_shrinkstack (lua_State *L) { 246void luaD_shrinkstack (lua_State *L) {
247 int inuse = stackinuse(L); 247 int inuse = stackinuse(L);
248 int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; 248 int goodsize = inuse + BASIC_STACK_SIZE;
249 if (goodsize > LUAI_MAXSTACK) 249 if (goodsize > LUAI_MAXSTACK)
250 goodsize = LUAI_MAXSTACK; /* respect stack limit */ 250 goodsize = LUAI_MAXSTACK; /* respect stack limit */
251 /* if thread is currently not handling a stack overflow and its 251 /* if thread is currently not handling a stack overflow and its
252 good size is smaller than current size, shrink its stack */ 252 good size is smaller than current size, shrink its stack */
253 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && 253 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && goodsize < L->stacksize)
254 goodsize < L->stacksize)
255 luaD_reallocstack(L, goodsize, 0); /* ok if that fails */ 254 luaD_reallocstack(L, goodsize, 0); /* ok if that fails */
256 else /* don't change stack */ 255 else /* don't change stack */
257 condmovestack(L,{},{}); /* (change only for debugging) */ 256 condmovestack(L,{},{}); /* (change only for debugging) */