I run the test code on http://lua-users.org/lists/lua-l/2010-06/msg00001.html. I found that the full gc is not triggered by function "
generationalcollection", but by function "
singlestep".
The test code just create string and table, so the gray list is empty, and grayagain is not empty, and result in GCmemtrav = 0, in the next genrational collection cycle will trigger a full gc.
See bellow, the assertion failed.
static lu_mem singlestep (lua_State *L) {
global_State *g = G(L);
switch (g->gcstate) {
case GCSpause: {
g->GCmemtrav = 0; /* start to count memory traversed */
if (!isgenerational(g))
&
nbsp; markroot(g); /* start a new collection */
/* in any case, root must be marked at this point */
lua_assert(!iswhite(obj2gco(g->mainthread))
&& !iswhite(gcvalue(&g->l_registry)));
g->gcstate = GCSpropagate;
+ assert(g->gray);
return g->GCmemtrav;
}