[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: why STEPMULADJ set to 200 by default and still works fine?
- From: "=?gb18030?b?Y2F0ZXJjaG9uZw==?=" <caterchong@...>
- Date: Thu, 25 Oct 2018 01:21:09 +0800
I've been studying source code of 5.3.4 for some time. I am confused abount the gc parameter "step multiplier".
According to lua default setting,
#define STEPMULADJ 200
#define LUAI_GCMUL 200 // GC runs 'twice the speed' of memory allocation
If lua malloc X bytes, global->GCdebt increase X.
Howerver, during propagate peroid, if traverse Y bytes£¬
In luaC_step function:
debt = (debt / g->gcstepmul) * STEPMULADJ
Ignoring integer dividing precision loss, debt/work ratio is 1:1
I cann't see why "GC runs 'twice the speed' of memory allocation"
According to my test, the default setting works fine. These must be something wrong with my calculation.
Can somebody help me? Thanks a lot.