diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-30 15:36:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-30 15:36:45 -0300 |
commit | b9e1dec2cbba49c7d6f902080beaf7467231e1fd (patch) | |
tree | 3753985821eb39b719b0ac9f74db3e191c82b17f /lgc.h | |
parent | dc2b8a0073be63a9e66a7028d7e72fcbb5f76cd1 (diff) | |
download | lua-b9e1dec2cbba49c7d6f902080beaf7467231e1fd.tar.gz lua-b9e1dec2cbba49c7d6f902080beaf7467231e1fd.tar.bz2 lua-b9e1dec2cbba49c7d6f902080beaf7467231e1fd.zip |
added comment explaining a bit about the invariants of the collector
Diffstat (limited to 'lgc.h')
-rw-r--r-- | lgc.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 2.31 2010/04/29 17:32:40 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.32 2010/04/29 21:43:36 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 | */ |
@@ -11,6 +11,19 @@ | |||
11 | #include "lobject.h" | 11 | #include "lobject.h" |
12 | #include "lstate.h" | 12 | #include "lstate.h" |
13 | 13 | ||
14 | /* | ||
15 | ** Collectable objects may have one of three colors: white, which | ||
16 | ** means the object is not marked; gray, which means the | ||
17 | ** object is marked, but its references may be not marked; and | ||
18 | ** black, which means that the object and all its references are marked. | ||
19 | ** The main invariant of the garbage collector, while marking objects, | ||
20 | ** is that a black object can never point to a white one. Moreover, | ||
21 | ** any gray object must be in a "gray list" (gray, grayagain, weak, | ||
22 | ** allweak, ephemeron) so that it can be visited again before finishing | ||
23 | ** the collection cycle. These lists have no meaning when the invariant | ||
24 | ** is not being enforced (e.g., sweep phase). | ||
25 | */ | ||
26 | |||
14 | 27 | ||
15 | /* | 28 | /* |
16 | ** Possible states of the Garbage Collector | 29 | ** Possible states of the Garbage Collector |