lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


How these parameters should be set?

This is something we are trying to find out too ;)

I'm getting a reasonable behavior with the following modification
(patch is below). It changes the dimension of stepmul to bytes.
Following the assumption that time spent collecting younger
generation does not depend on the size of the older generation.

However, with my test script and fprintf patch,
every short collection except the one immediately after
the full gc seems to collect 0 bytes, judging by the
value of totalbytes. It can also be seen
in my "[fixed version] ..." reply. Maybe it's again
misunderstanding on my part..

Also, would it make sense to adjust generational collection
so that short gc leaves uncollected objects white,
while full gc creates old objects?

=============================================================
--- lua-5.2.0-work3/src/lgc.c   2010-05-17 23:39:31.000000000 +0300
+++ l520w3-ggctune/src/lgc.c    2010-06-01 13:13:05.000000000 +0300
@@ -51,7 +51,7 @@
 ** standard negative debt for GC; a reasonable "time" to wait before
 ** starting a new cycle
 */
-#define stddebt(g)     (-cast(l_mem, g->totalbytes/100) * g->gcpause)
+#define stddebt(g) (isgenerational(g)?-g->gcstepmul:-cast(l_mem, g->totalbytes/100 * g->gcpause))


 /*
@@ -782,6 +782,7 @@
   if (mode == KGC_GEN) {  /* change to generational mode */
     /* make sure gray lists are consistent */
     luaC_runtilstate(L, bitmask(GCSpropagate));
+    if (g->GCdebt < -GCSTEPSIZE) g->GCdebt = -GCSTEPSIZE;
     g->lastmajormem = g->totalbytes;
     g->gckind = KGC_GEN;
   }

 static void generationalcollection (lua_State *L) {
   global_State *g = G(L);
-  if (g->lastmajormem == 0) {  /* signal for another major collection? */
+  if (g->totalbytes > g->lastmajormem / 100 * g->gcpause) {
     luaC_fullgc(L, 0);  /* perform a full regular collection */
     g->lastmajormem = g->totalbytes;  /* update control */
   }
   else {
     luaC_runtilstate(L, bitmask(GCSpause));  /* run collection */
-    if (g->totalbytes > g->lastmajormem/100 * g->gcpause)
-      g->lastmajormem = 0;  /* signal for a major collection */
   }
   g->GCdebt = stddebt(g);
 }