lua-users home
lua-l archive

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

it seems like Makoto diagnosed the problem correctly.

In fact in lgc.c:610 luaC_step checks if the collector has reached a
pause, and in that case it calls the macro setthreshold which is

#define setthreshold(g)  (g->GCthreshold = (g->estimate/100) * g->gcpause)

In the case of the freezes, it seems this fails to either strictly
increase the threshold. Since also the total number of bytes in use is
unchanged (a single step is sufficiently large to recollect all the
memory used for the command), the basic assumption for exiting the
loop in lua_gc fails.

I still have to understand one thing:
right after a GC pause, are g->estimate and g->totalbytes equal? it seemed so.
lua asserts that g->totalbytes>=g->estimate but that seems to be the
issue at hand. In fact the check in lua_gc becomes equivalent to
(g->totalbytes < g->gcpause*g->estimate/100) which should not be true
if g->gcpause==100
I did not investigate yet why x86_64 did work, instead.

moreover, putting this line after lgc.c:631 removes the freeze:
if (g->totalbytes >= g->GCthreshold) g->GCthreshold = g->totalbytes+1;
and since luaC_step is only used by lua_gc it has little consequences.
But it would seem better to change the setthreshold macro.

2008/7/3 Roberto Ierusalimschy <>:
> I think Makoto has a point, despite his disregard for the Don't-claim-
> that-you-have-found-a-bug rule:
>  "It's especially undiplomatic to yell 'bug' in the Subject line."
> Whether it is a bug is not that relevant. What is relevant is whether this
> is a "good" behavior, and it looks like it is not.
> -- Roberto