The reason for this is that at the end of gc sweep, gcstate switch to pause,
[F] g->GCDebt = totalbytes - E * P / 100,
E:=g->GCestimate (memory traversed by the propagate state)
P:=g->gcpause (set by collectgarbage("setpause"))
Because traversetable() doesn't calculate the inner GCObject and nest
table's size,
I don't think it's the real reason.
GCestimate is the total memory marked in mark phase, setpause() would set a threshold (double the memory in default). g->GCdebt is usually a negative number after setpause().
But lua call setpause() to set the threshold after sweep phase. If you allocate too many new objects during the sweep phase, the g->GCdebt could be a large positive number.
I think we could check the debt in setpause(), if it is a positive number, don't set it. (positive debt doesn't pause the GC cycle, it accelerates the GC cycle )