diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-10 14:13:50 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-10 14:13:50 -0300 |
| commit | 127e7a6c8942b362aa3c6627f44d660a4fb75312 (patch) | |
| tree | ecd678dbffbf7b0999ff8b444b169641b33f9a0e | |
| parent | 6f5bd5072dff07679c390eecfeaa9d20cc45a9ef (diff) | |
| download | lua-127e7a6c8942b362aa3c6627f44d660a4fb75312.tar.gz lua-127e7a6c8942b362aa3c6627f44d660a4fb75312.tar.bz2 lua-127e7a6c8942b362aa3c6627f44d660a4fb75312.zip | |
Fixed bug of old finalized objects in the GC
When an object aged OLD1 is finalized, it is moved from the list
'finobj' to the *beginning* of the list 'allgc'. So, this part of the
list (and not only the survival list) must be visited by 'markold'.
| -rw-r--r-- | lgc.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -1131,16 +1131,14 @@ static void finishgencycle (lua_State *L, global_State *g) { | |||
| 1131 | 1131 | ||
| 1132 | 1132 | ||
| 1133 | /* | 1133 | /* |
| 1134 | ** Does a young collection. First, mark 'OLD1' objects. (Only survival | 1134 | ** Does a young collection. First, mark 'OLD1' objects. Then does the |
| 1135 | ** and "recent old" lists can contain 'OLD1' objects. New lists cannot | 1135 | ** atomic step. Then, sweep all lists and advance pointers. Finally, |
| 1136 | ** contain 'OLD1' objects, at most 'OLD0' objects that were already | 1136 | ** finish the collection. |
| 1137 | ** visited when marked old.) Then does the atomic step. Then, | ||
| 1138 | ** sweep all lists and advance pointers. Finally, finish the collection. | ||
| 1139 | */ | 1137 | */ |
| 1140 | static void youngcollection (lua_State *L, global_State *g) { | 1138 | static void youngcollection (lua_State *L, global_State *g) { |
| 1141 | GCObject **psurvival; /* to point to first non-dead survival object */ | 1139 | GCObject **psurvival; /* to point to first non-dead survival object */ |
| 1142 | lua_assert(g->gcstate == GCSpropagate); | 1140 | lua_assert(g->gcstate == GCSpropagate); |
| 1143 | markold(g, g->survival, g->reallyold); | 1141 | markold(g, g->allgc, g->reallyold); |
| 1144 | markold(g, g->finobj, g->finobjrold); | 1142 | markold(g, g->finobj, g->finobjrold); |
| 1145 | atomic(L); | 1143 | atomic(L); |
| 1146 | 1144 | ||
