summaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-14 15:53:35 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-14 15:53:35 -0200
commitb6ebbb2fee13aa223fdd12921cd0411e02db9dd0 (patch)
tree03320716aa1cb444e50981dbfea93a89f2cea5cb /lstate.c
parentc5fee7615e979e3a39af44614f82938519dedb68 (diff)
downloadlua-github-b6ebbb2fee13aa223fdd12921cd0411e02db9dd0.tar.gz
better assertions.
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lstate.c b/lstate.c
index c8f3d65b..281206bc 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.c,v 1.13 1999/08/16 20:52:00 roberto Exp roberto $
+** $Id: lstate.c,v 1.14 1999/10/04 17:51:04 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
@@ -53,6 +53,10 @@ void lua_open (void) {
void lua_close (void) {
luaC_collect(1); /* collect all elements */
+ LUA_ASSERT(L->rootproto == NULL, "list should be empty");
+ LUA_ASSERT(L->rootcl == NULL, "list should be empty");
+ LUA_ASSERT(L->rootglobal == NULL, "list should be empty");
+ LUA_ASSERT(L->roottable == NULL, "list should be empty");
luaS_freeall();
luaM_free(L->stack.stack);
luaM_free(L->IMtable);
@@ -61,11 +65,9 @@ void lua_close (void) {
luaM_free(L->Cblocks);
LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
luaM_free(L);
+ LUA_ASSERT(numblocks == 0, "memory leak!");
+ LUA_ASSERT(totalmem == 0,"memory leak!");
L = NULL;
-#ifdef DEBUG
- printf("total de blocos: %ld\n", numblocks);
- printf("total de memoria: %ld\n", totalmem);
-#endif
}