mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Improve GC estimation for userdata with attached managed memory.
This works well for string.buffers, but not for userdata or cdata with attached unmanaged memory (malloc/free, mmap/munmap).
This commit is contained in:
parent
9c3df68a1e
commit
a7d0265480
@ -700,9 +700,12 @@ static size_t gc_onestep(lua_State *L)
|
||||
}
|
||||
case GCSfinalize:
|
||||
if (gcref(g->gc.mmudata) != NULL) {
|
||||
GCSize old = g->gc.total;
|
||||
if (tvref(g->jit_base)) /* Don't call finalizers on trace. */
|
||||
return LJ_MAX_MEM;
|
||||
gc_finalize(L); /* Finalize one userdata object. */
|
||||
if (old >= g->gc.total && g->gc.estimate > old - g->gc.total)
|
||||
g->gc.estimate -= old - g->gc.total;
|
||||
if (g->gc.estimate > GCFINALIZECOST)
|
||||
g->gc.estimate -= GCFINALIZECOST;
|
||||
return GCFINALIZECOST;
|
||||
|
Loading…
Reference in New Issue
Block a user