aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-10 14:13:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-10 14:13:50 -0300
commit127e7a6c8942b362aa3c6627f44d660a4fb75312 (patch)
treeecd678dbffbf7b0999ff8b444b169641b33f9a0e
parent6f5bd5072dff07679c390eecfeaa9d20cc45a9ef (diff)
downloadlua-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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lgc.c b/lgc.c
index f26c921a..f7fd7a59 100644
--- a/lgc.c
+++ b/lgc.c
@@ -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*/
1140static void youngcollection (lua_State *L, global_State *g) { 1138static 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