diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-20 15:24:33 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-20 15:24:33 -0300 |
| commit | c354211744e80c14314b3a363e7d57f5751be835 (patch) | |
| tree | cebedfc3dba641f8ed073c81cfcc0d0bf29261ab | |
| parent | f748b4bb40bf94303d5cc609006054c0e9b7b2d7 (diff) | |
| download | lua-c354211744e80c14314b3a363e7d57f5751be835.tar.gz lua-c354211744e80c14314b3a363e7d57f5751be835.tar.bz2 lua-c354211744e80c14314b3a363e7d57f5751be835.zip | |
small bug in generational control
| -rw-r--r-- | lgc.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.222 2017/04/12 18:01:40 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.223 2017/04/19 17:02:50 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 | */ |
| @@ -1207,17 +1207,18 @@ static void fullgen (lua_State *L, global_State *g) { | |||
| 1207 | */ | 1207 | */ |
| 1208 | static void genstep (lua_State *L, global_State *g) { | 1208 | static void genstep (lua_State *L, global_State *g) { |
| 1209 | lu_mem majorbase = g->GCestimate; | 1209 | lu_mem majorbase = g->GCestimate; |
| 1210 | lua_checkmemory(L); | 1210 | //lua_checkmemory(L); |
| 1211 | if (gettotalbytes(g) > (majorbase / 100) * (100 + g->genmajormul)) | 1211 | if (gettotalbytes(g) > (majorbase / 100) * (100 + g->genmajormul)) { |
| 1212 | fullgen(L, g); | 1212 | fullgen(L, g); |
| 1213 | } | ||
| 1213 | else { | 1214 | else { |
| 1214 | lu_mem mem; | 1215 | lu_mem mem; |
| 1215 | youngcollection(L, g); | 1216 | youngcollection(L, g); |
| 1216 | mem = gettotalbytes(g); | 1217 | mem = gettotalbytes(g); |
| 1217 | luaE_setdebt(g, -((mem / 100) * g->genminormul)); | 1218 | luaE_setdebt(g, -((mem / 100) * g->genminormul)); |
| 1218 | g->GCestimate = mem; | 1219 | g->GCestimate = majorbase; /* preserve base value */ |
| 1219 | } | 1220 | } |
| 1220 | lua_checkmemory(L); | 1221 | //lua_checkmemory(L); |
| 1221 | } | 1222 | } |
| 1222 | 1223 | ||
| 1223 | 1224 | ||
