Skip to content

Commit

Permalink
lj_state.c: Restore assertion that all memory is deallocated
Browse files Browse the repository at this point in the history
Repay some technical debt: I had disabled the lua_assert() checking
that when the VM closes the number of bytes freed is exactly the same
as the number of bytes allocated i.e. we were not defending against
memory leaks.
  • Loading branch information
lukego committed Oct 8, 2018
1 parent a667ead commit 3b80633
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/lj_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ static void close_state(lua_State *L)
lj_mem_free(g, J->snapbuf, sizeof(SnapShot)*65536);
lj_mem_free(g, J->irbuf, 65536*sizeof(IRIns));
lj_mem_free(g, J->trace, TRACE_MAX * sizeof(GCRef *));
#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 3b80633

Please sign in to comment.