dead objects are not collectable.

This commit is contained in:
Roberto Ierusalimschy
2011-09-24 18:12:01 -03:00
parent 5645a84368
commit 87912786af
3 changed files with 11 additions and 8 deletions

7
lgc.c
View File

@@ -100,12 +100,13 @@ static void reallymarkobject (global_State *g, GCObject *o);
/*
** mark a table entry as dead (therefore removing it from the table)
** if key is not marked, mark its entry as dead (therefore removing it
** from the table)
*/
static void removeentry (Node *n) {
lua_assert(ttisnil(gval(n)));
if (iscollectable(gkey(n)))
setdeadvalue(gkey(n)); /* dead key; remove it */
if (valiswhite(gkey(n)))
setdeadvalue(gkey(n)); /* unused and unmarked key; remove it */
}