Skip to content

Commit 127e7a6

Browse files
committed
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'.
1 parent 6f5bd50 commit 127e7a6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lgc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,16 +1131,14 @@ static void finishgencycle (lua_State *L, global_State *g) {
11311131

11321132

11331133
/*
1134-
** Does a young collection. First, mark 'OLD1' objects. (Only survival
1135-
** and "recent old" lists can contain 'OLD1' objects. New lists cannot
1136-
** contain 'OLD1' objects, at most 'OLD0' objects that were already
1137-
** visited when marked old.) Then does the atomic step. Then,
1138-
** sweep all lists and advance pointers. Finally, finish the collection.
1134+
** Does a young collection. First, mark 'OLD1' objects. Then does the
1135+
** atomic step. Then, sweep all lists and advance pointers. Finally,
1136+
** finish the collection.
11391137
*/
11401138
static void youngcollection (lua_State *L, global_State *g) {
11411139
GCObject **psurvival; /* to point to first non-dead survival object */
11421140
lua_assert(g->gcstate == GCSpropagate);
1143-
markold(g, g->survival, g->reallyold);
1141+
markold(g, g->allgc, g->reallyold);
11441142
markold(g, g->finobj, g->finobjrold);
11451143
atomic(L);
11461144

0 commit comments

Comments
 (0)