lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 127e7a6c8942b362aa3c6627f44d660a4fb75312
parent 6f5bd5072dff07679c390eecfeaa9d20cc45a9ef
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 10 Jul 2020 14:13:23 -0300

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'.

Diffstat:
Mlgc.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lgc.c b/lgc.c @@ -1131,16 +1131,14 @@ static void finishgencycle (lua_State *L, global_State *g) { /* -** Does a young collection. First, mark 'OLD1' objects. (Only survival -** and "recent old" lists can contain 'OLD1' objects. New lists cannot -** contain 'OLD1' objects, at most 'OLD0' objects that were already -** visited when marked old.) Then does the atomic step. Then, -** sweep all lists and advance pointers. Finally, finish the collection. +** Does a young collection. First, mark 'OLD1' objects. Then does the +** atomic step. Then, sweep all lists and advance pointers. Finally, +** finish the collection. */ static void youngcollection (lua_State *L, global_State *g) { GCObject **psurvival; /* to point to first non-dead survival object */ lua_assert(g->gcstate == GCSpropagate); - markold(g, g->survival, g->reallyold); + markold(g, g->allgc, g->reallyold); markold(g, g->finobj, g->finobjrold); atomic(L);