diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.208 2015/11/02 16:19:29 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.209 2015/11/02 18:48:07 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -114,8 +114,13 @@ static void reallymarkobject (global_State *g, GCObject *o); | |||
114 | 114 | ||
115 | 115 | ||
116 | /* | 116 | /* |
117 | ** if key is not marked, mark its entry as dead (therefore removing it | 117 | ** If key is not marked, mark its entry as dead. This allows key to be |
118 | ** from the table) | 118 | ** collected, but keeps its entry in the table. A dead node is needed |
119 | ** when Lua looks up for a key (it may be part of a chain) and when | ||
120 | ** traversing a weak table (key might be removed from the table during | ||
121 | ** traversal). Other places never manipulate dead keys, because its | ||
122 | ** associated nil value is enough to signal that the entry is logically | ||
123 | ** empty. | ||
119 | */ | 124 | */ |
120 | static void removeentry (Node *n) { | 125 | static void removeentry (Node *n) { |
121 | lua_assert(ttisnil(gval(n))); | 126 | lua_assert(ttisnil(gval(n))); |