draft version of a generational mode for garbage collection. (Not well

tested; no major collections; ...)
This commit is contained in:
Roberto Ierusalimschy
2010-03-22 15:28:03 -03:00
parent 9c196bebad
commit 74123e9686
5 changed files with 70 additions and 35 deletions

8
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.113 2010/02/09 11:55:37 roberto Exp roberto $
** $Id: lapi.c,v 2.114 2010/03/08 16:55:52 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -928,6 +928,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
break;
}
case LUA_GCRESTART: {
g->gckind = KGC_NORMAL;
g->GCthreshold = g->totalbytes;
break;
}
@@ -973,6 +974,11 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
res = (g->GCthreshold != MAX_LUMEM);
break;
}
case LUA_GCGEN: { /* change collector to generational mode */
luaC_runtilstate(L, bitmask(GCSpropagate));
g->gckind = KGC_GEN;
break;
}
default: res = -1; /* invalid option */
}
lua_unlock(L);