mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Release all memory when using the builtin allocator.
Blocks >128K are not kept in the segment list and were not destroyed.
This commit is contained in:
parent
c88169dc46
commit
32bfececc5
@ -155,15 +155,6 @@ static TValue *cpluaopen(lua_State *L, lua_CFunction dummy, void *ud)
|
||||
static void close_state(lua_State *L)
|
||||
{
|
||||
global_State *g = G(L);
|
||||
#ifndef LUAJIT_USE_SYSMALLOC
|
||||
if (g->allocf == lj_alloc_f) {
|
||||
#if LJ_HASJIT
|
||||
lj_mcode_free(G2J(g));
|
||||
#endif
|
||||
lj_alloc_destroy(g->allocd);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
lj_func_closeuv(L, tvref(L->stack));
|
||||
lj_gc_freeall(g);
|
||||
lua_assert(gcref(g->gc.root) == obj2gco(L));
|
||||
@ -173,8 +164,12 @@ static void close_state(lua_State *L)
|
||||
lj_str_freebuf(g, &g->tmpbuf);
|
||||
lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue);
|
||||
lua_assert(g->gc.total == sizeof(GG_State));
|
||||
#ifndef LUAJIT_USE_SYSMALLOC
|
||||
if (g->allocf == lj_alloc_f)
|
||||
lj_alloc_destroy(g->allocd);
|
||||
else
|
||||
#endif
|
||||
g->allocf(g->allocd, G2GG(g), sizeof(GG_State), 0);
|
||||
}
|
||||
}
|
||||
|
||||
#if LJ_64
|
||||
|
Loading…
Reference in New Issue
Block a user