lua-users home
lua-l archive

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


> If I adjust GCSWEEPCOST to a larger value,
> the time of sweep state becomes long,
> and CPU's usage becomes lower.
> But it is a little difficult to adjust GCSWEEPCOST to a fit value;
> 
> I am curious about why sweepstep() doesn't return the real free bytes, i.e, olddebt - g->GCdebt ?

In most (all?) systems, the time to free a block does not depend on its
size. More important, we waste time doing a sweep even if we do not
release any memory. So, I do not see why the measure of "work" done
during a sweep should be related to how much memory was freed.
(We could use the size of object being sweeped, but that increases the
work done during a sweep, and again, the time to sweep an object does
not depend on its size.)

That said, all these constants (like GCSWEEPCOST, STEPMULADJ) are rough
guesses, and substantiated suggestions for better values are more
than welcome.


> In our program, collectgarbage("count") is 10G at the end of propagate state,
> while gc switch to sweep state, gc system free 5G bytes in only 30 seconds,
> and the usage of CPU is 99.9% during the whole 30 seconds sweep state;

Is that a problem? Is your program too slow during that period? If you
just feel the sweep is too fast, you can compensate it by setting a
longer pause after the sweep.

-- Roberto