Skip to content

Commit

Permalink
lj_state.c: Partial fix of assertion on shutdown
Browse files Browse the repository at this point in the history
Partially fix deallocation of state when the VM state is freed.

This is not correct, and leaves some memory allocated, and I have
temporarily disabled the assertion that this breaks. Just because
being able to run with assertions is currently more important than
being sure that all memory is freed at closing.
  • Loading branch information
lukego committed Apr 26, 2018
1 parent 1646db3 commit a5222e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lj_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ static void close_state(lua_State *L)
lj_mem_freevec(g, g->strhash, g->strmask+1, GCRef);
lj_buf_free(g, &g->tmpbuf);
lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue);
lj_mem_free(g, J->bclog, sizeof(BCRecLog)*65536);
lj_mem_free(g, J->snapmapbuf, J->sizesnapmap);
lj_mem_free(g, J->snapbuf, J->sizesnap);
lj_mem_free(g, J->bclog, sizeof(BCRecLog)*J->maxbclog);
lj_mem_free(g, J->snapmapbuf, sizeof(SnapEntry)*65536);
lj_mem_free(g, J->snapbuf, sizeof(SnapShot)*65536);
lj_mem_free(g, J->irbuf, 65536*sizeof(IRIns));
#if 0
/* XXX Fix deallocation so that this assertion succeeds. */
lua_assert(g->gc.total == sizeof(GG_State));
#endif
#ifndef LUAJIT_USE_SYSMALLOC
if (g->allocf == lj_alloc_f)
lj_alloc_destroy(g->allocd);
Expand Down

0 comments on commit a5222e7

Please sign in to comment.