mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Prevent GC estimate miscalculation due to buffer growth.
This commit is contained in:
parent
18309b0a25
commit
2715fe3aee
@ -631,6 +631,8 @@ static size_t gc_onestep(lua_State *L)
|
|||||||
case GCSsweep: {
|
case GCSsweep: {
|
||||||
MSize old = g->gc.total;
|
MSize old = g->gc.total;
|
||||||
setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
|
setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
|
||||||
|
lua_assert(old >= g->gc.total);
|
||||||
|
g->gc.estimate -= old - g->gc.total;
|
||||||
if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
|
if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
|
||||||
gc_shrink(g, L);
|
gc_shrink(g, L);
|
||||||
if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
|
if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
|
||||||
@ -643,8 +645,6 @@ static size_t gc_onestep(lua_State *L)
|
|||||||
g->gc.debt = 0;
|
g->gc.debt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lua_assert(old >= g->gc.total);
|
|
||||||
g->gc.estimate -= old - g->gc.total;
|
|
||||||
return GCSWEEPMAX*GCSWEEPCOST;
|
return GCSWEEPMAX*GCSWEEPCOST;
|
||||||
}
|
}
|
||||||
case GCSfinalize:
|
case GCSfinalize:
|
||||||
|
Loading…
Reference in New Issue
Block a user