lua-users home
lua-l archive

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


64bit freezes here too using step multiplier of 20000, which is high
enough that the single step ends the cycle.

I can't say how this should be fixed, because I don't know GC (this
and in general) so much, however given this macro

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

I wonder whether it makes any sense to allow for gcpause<100. Also,
since this is integer division, threshold may be well under estimate
(and totalbytes) even for gcpause==100. Anyway, maybe a mention of
this in the manual could be nice, even if not strictly necessary.


2008/7/4 Mauro Iazzi <mauro.iazzi@gmail.com>:
> 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
> defined
>
> #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 <roberto@inf.puc-rio.br>:
>> 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
>>
>