commit b9e1dec2cbba49c7d6f902080beaf7467231e1fd
parent dc2b8a0073be63a9e66a7028d7e72fcbb5f76cd1
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 30 Apr 2010 15:36:21 -0300
added comment explaining a bit about the invariants of the collector
Diffstat:
M | lgc.h | | | 15 | ++++++++++++++- |
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lgc.h b/lgc.h
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.h,v 2.31 2010/04/29 17:32:40 roberto Exp roberto $
+** $Id: lgc.h,v 2.32 2010/04/29 21:43:36 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -11,6 +11,19 @@
#include "lobject.h"
#include "lstate.h"
+/*
+** Collectable objects may have one of three colors: white, which
+** means the object is not marked; gray, which means the
+** object is marked, but its references may be not marked; and
+** black, which means that the object and all its references are marked.
+** The main invariant of the garbage collector, while marking objects,
+** is that a black object can never point to a white one. Moreover,
+** any gray object must be in a "gray list" (gray, grayagain, weak,
+** allweak, ephemeron) so that it can be visited again before finishing
+** the collection cycle. These lists have no meaning when the invariant
+** is not being enforced (e.g., sweep phase).
+*/
+
/*
** Possible states of the Garbage Collector