Calling mps_arena_step with a multiplier of 0 and a nonzero interval results in an unsigned overflow and unintended full collections, at least when Clock is an unsigned type, as it is here.
if (PolicyShouldCollectWorld(arena, (double)(availableEnd - now), now,
clocks_per_sec))
{
in global.c results in this, in some cases: if the loop runs more than once, it is possible for availableEnd to be the original now, now to be the new now (thus greater), but still less than intervalEnd. This results in (double)(availableEnd - now) to be a very large number when it should actually be less than 0.
I thought this was a case of pilot error and not worth reporting, but the documentation recommends the multiplier of 0.0 in its proposed event loop.
TBH, it's not entirely clear to me what the precise semantics of the multiplier and interval parameters are, even after reading the documentation. I suspect that in the Emacs case, we would prefer no opportunistic full collections to be started, which would require passing 0.0 as multiplier and fixing the code, I think.
Calling
mps_arena_stepwith a multiplier of0and a nonzero interval results in an unsigned overflow and unintended full collections, at least whenClockis an unsigned type, as it is here.in
global.cresults in this, in some cases: if the loop runs more than once, it is possible foravailableEndto be the originalnow,nowto be the newnow(thus greater), but still less thanintervalEnd. This results in(double)(availableEnd - now)to be a very large number when it should actually be less than 0.I thought this was a case of pilot error and not worth reporting, but the documentation recommends the multiplier of
0.0in its proposed event loop.TBH, it's not entirely clear to me what the precise semantics of the
multiplierandintervalparameters are, even after reading the documentation. I suspect that in the Emacs case, we would prefer no opportunistic full collections to be started, which would require passing0.0as multiplier and fixing the code, I think.