diff options
author | Mike Pall <mike> | 2014-04-22 11:26:52 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2014-04-22 11:26:52 +0200 |
commit | 2715fe3aee7c8202b4b5d04748d1c5faa6d8fd9c (patch) | |
tree | c8ad75a38cfbfeaa5d4723f06b5e0a13211c30b3 /src/lj_gc.c | |
parent | 18309b0a25babe1a7d601d2ee92ce1dba1859ef9 (diff) | |
download | luajit2-2715fe3aee7c8202b4b5d04748d1c5faa6d8fd9c.tar.gz |
Prevent GC estimate miscalculation due to buffer growth.
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r-- | src/lj_gc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c index c2bc397d..c856df4d 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c @@ -631,6 +631,8 @@ static size_t gc_onestep(lua_State *L) case GCSsweep: { MSize old = g->gc.total; 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) { gc_shrink(g, L); if (gcref(g->gc.mmudata)) { /* Need any finalizations? */ @@ -643,8 +645,6 @@ static size_t gc_onestep(lua_State *L) g->gc.debt = 0; } } - lua_assert(old >= g->gc.total); - g->gc.estimate -= old - g->gc.total; return GCSWEEPMAX*GCSWEEPCOST; } case GCSfinalize: |