aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-29 10:34:16 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-29 10:34:16 -0300
commitb5e75fde4ec36b7db0a02cc8a353f8d3a769cfed (patch)
tree4c791e863419cb6d8019b546997f7c604b944b9c
parent9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9 (diff)
downloadlua-b5e75fde4ec36b7db0a02cc8a353f8d3a769cfed.tar.gz
lua-b5e75fde4ec36b7db0a02cc8a353f8d3a769cfed.tar.bz2
lua-b5e75fde4ec36b7db0a02cc8a353f8d3a769cfed.zip
bug: local collection must clear rest of stack
-rw-r--r--lgc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lgc.c b/lgc.c
index 8661fe8d..8d273d44 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.154 2013/08/27 20:04:00 roberto Exp roberto $ 2** $Id: lgc.c,v 2.155 2013/08/28 18:30:26 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*/
@@ -25,7 +25,7 @@
25 25
26 26
27/* 27/*
28** How memory to allocate before a new local collection 28** How much memory to allocate before a new local collection
29*/ 29*/
30#define GCLOCALPAUSE 8000 30#define GCLOCALPAUSE 8000
31 31
@@ -894,12 +894,15 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
894*/ 894*/
895static void localmarkthread (lua_State *l) { 895static void localmarkthread (lua_State *l) {
896 StkId o = l->stack; 896 StkId o = l->stack;
897 StkId lim = l->stack + l->stacksize; /* real end of stack */
897 if (o == NULL) 898 if (o == NULL)
898 return; /* stack not completely built yet */ 899 return; /* stack not completely built yet */
899 for (; o < l->top; o++) { /* mark live elements in the stack */ 900 for (; o < l->top; o++) { /* mark live elements in the stack */
900 if (iscollectable(o)) 901 if (iscollectable(o))
901 l_setbit(gcvalue(o)->gch.marked, LOCALMARK); 902 l_setbit(gcvalue(o)->gch.marked, LOCALMARK);
902 } 903 }
904 for (; o < lim; o++) /* clear not-marked stack slice */
905 setnilvalue(o);
903} 906}
904 907
905 908