aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-02 14:23:20 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-02 14:23:20 -0200
commit42224ca5538293f2b4a217e813bc437ca673b3cf (patch)
tree828645aee767bc1d5cc54089f2446b8854d3dabb
parent426d3e43bdec4b1ab2b0aed1844396c27f64872f (diff)
downloadlua-42224ca5538293f2b4a217e813bc437ca673b3cf.tar.gz
lua-42224ca5538293f2b4a217e813bc437ca673b3cf.tar.bz2
lua-42224ca5538293f2b4a217e813bc437ca673b3cf.zip
loop of 'dostring' may never reclaim memory
-rw-r--r--bugs4
-rw-r--r--ldo.c6
-rw-r--r--lgc.c4
-rw-r--r--lgc.h3
4 files changed, 12 insertions, 5 deletions
diff --git a/bugs b/bugs
index 220a36bf..c9429268 100644
--- a/bugs
+++ b/bugs
@@ -255,3 +255,7 @@ Thu Feb 1 11:55:45 EDT 2001
255>> lua_pushuserdata(L, NULL) is buggy 255>> lua_pushuserdata(L, NULL) is buggy
256(by Edgar Toernig; since 4.0) 256(by Edgar Toernig; since 4.0)
257 257
258** ldo.c
259Fri Feb 2 14:06:40 EDT 2001
260>> «while 1 dostring[[print('hello\n')]] end» never reclaims memory
261(by Andrew Paton; since 4.0b)
diff --git a/ldo.c b/ldo.c
index 296352fe..24f4a169 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.120 2001/02/01 17:40:48 roberto Exp roberto $ 2** $Id: ldo.c,v 1.121 2001/02/02 15:13:05 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -251,7 +251,9 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
251 int status; 251 int status;
252 LUA_LOCK(L); 252 LUA_LOCK(L);
253 p.z = z; p.bin = bin; 253 p.z = z; p.bin = bin;
254 luaC_checkGC(L); 254 /* before parsing, give a (good) chance to GC */
255 if (G(L)->nblocks/8 >= G(L)->GCthreshold/10)
256 luaC_collectgarbage(L);
255 old_blocks = G(L)->nblocks; 257 old_blocks = G(L)->nblocks;
256 status = luaD_runprotected(L, f_parser, &p); 258 status = luaD_runprotected(L, f_parser, &p);
257 if (status == 0) { 259 if (status == 0) {
diff --git a/lgc.c b/lgc.c
index d980d8e8..48a022e9 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.84 2001/02/01 17:40:48 roberto Exp roberto $ 2** $Id: lgc.c,v 1.85 2001/02/02 15:13:05 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*/
@@ -375,7 +375,7 @@ void luaC_collect (lua_State *L, int all) {
375} 375}
376 376
377 377
378static void luaC_collectgarbage (lua_State *L) { 378void luaC_collectgarbage (lua_State *L) {
379 markall(L); 379 markall(L);
380 invalidaterefs(G(L)); /* check unlocked references */ 380 invalidaterefs(G(L)); /* check unlocked references */
381 luaC_collect(L, 0); 381 luaC_collect(L, 0);
diff --git a/lgc.h b/lgc.h
index 73845da9..b1f995cc 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 1.7 1999/11/22 13:12:07 roberto Exp roberto $ 2** $Id: lgc.h,v 1.8 2000/10/02 14:47:43 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*/
@@ -12,6 +12,7 @@
12 12
13 13
14void luaC_collect (lua_State *L, int all); 14void luaC_collect (lua_State *L, int all);
15void luaC_collectgarbage (lua_State *L);
15void luaC_checkGC (lua_State *L); 16void luaC_checkGC (lua_State *L);
16 17
17 18