[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LUA_DEBUG & lua_open()/close() order
- From: davidguy@...
- Date: Sun, 22 Jul 2001 21:28:12 -0000
Hi,
Does building the Lua libraries with LUA_DEBUG defined, set the
requirement that Lua states be closed opposite the order in which
they where opened?
I ask because when LUA_DEBUG is defined, the following causes an
assert inside lua_close() to fail:
lua_State *state0 = lua_open( 0 );
lua_State *state1 = lua_open( 0 );
/* nothing is done with the states here */
lua_close( state0 ); /* <== assertion failure here */
lua_close( state1 );
but this does not:
lua_State *state0 = lua_open( 0 );
lua_State *state1 = lua_open( 0 );
lua_close( state1 );
lua_close( state0 );
The assert that fails is at in lstate.c, line 119:
LUA_ASSERT(L != lua_state || memdebug_numblocks == 0, "memory
leak!");
If I build the libraries with out LUA_DEBUG defined, both code
snippits above work fine. I've build the library with both the Lcc-
Win32 and MSVC++ compilers, with the same results.
BTW, I'm using version 4.0.
Any insights,
David