diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-02 14:23:20 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-02 14:23:20 -0200 |
commit | 42224ca5538293f2b4a217e813bc437ca673b3cf (patch) | |
tree | 828645aee767bc1d5cc54089f2446b8854d3dabb | |
parent | 426d3e43bdec4b1ab2b0aed1844396c27f64872f (diff) | |
download | lua-42224ca5538293f2b4a217e813bc437ca673b3cf.tar.gz lua-42224ca5538293f2b4a217e813bc437ca673b3cf.tar.bz2 lua-42224ca5538293f2b4a217e813bc437ca673b3cf.zip |
loop of 'dostring' may never reclaim memory
-rw-r--r-- | bugs | 4 | ||||
-rw-r--r-- | ldo.c | 6 | ||||
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | lgc.h | 3 |
4 files changed, 12 insertions, 5 deletions
@@ -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 | ||
259 | Fri 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) | ||
@@ -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) { |
@@ -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 | ||
378 | static void luaC_collectgarbage (lua_State *L) { | 378 | void 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); |
@@ -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 | ||
14 | void luaC_collect (lua_State *L, int all); | 14 | void luaC_collect (lua_State *L, int all); |
15 | void luaC_collectgarbage (lua_State *L); | ||
15 | void luaC_checkGC (lua_State *L); | 16 | void luaC_checkGC (lua_State *L); |
16 | 17 | ||
17 | 18 | ||