aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lmem.c4
-rw-r--r--lmem.h3
-rw-r--r--ltests.c3
3 files changed, 7 insertions, 3 deletions
diff --git a/lmem.c b/lmem.c
index 00e45f6f..d1576782 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.27 2000/03/10 14:01:05 roberto Exp roberto $ 2** $Id: lmem.c,v 1.28 2000/03/10 18:37:44 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -54,6 +54,7 @@
54 54
55unsigned long memdebug_numblocks = 0; 55unsigned long memdebug_numblocks = 0;
56unsigned long memdebug_total = 0; 56unsigned long memdebug_total = 0;
57unsigned long memdebug_maxmem = 0;
57 58
58 59
59static void *checkblock (void *block) { 60static void *checkblock (void *block) {
@@ -95,6 +96,7 @@ static void *debug_realloc (void *block, size_t size) {
95 freeblock(block); /* erase (and check) old copy */ 96 freeblock(block); /* erase (and check) old copy */
96 } 97 }
97 memdebug_total += size; 98 memdebug_total += size;
99 if (memdebug_total > memdebug_maxmem) memdebug_maxmem = memdebug_total;
98 memdebug_numblocks++; 100 memdebug_numblocks++;
99 *(unsigned long *)newblock = size; 101 *(unsigned long *)newblock = size;
100 for (i=0;i<MARKSIZE;i++) 102 for (i=0;i<MARKSIZE;i++)
diff --git a/lmem.h b/lmem.h
index 3341ebd0..e5811354 100644
--- a/lmem.h
+++ b/lmem.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.h,v 1.11 1999/12/27 17:33:22 roberto Exp roberto $ 2** $Id: lmem.h,v 1.12 2000/01/13 16:30:47 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -36,6 +36,7 @@ void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, in
36#ifdef DEBUG 36#ifdef DEBUG
37extern unsigned long memdebug_numblocks; 37extern unsigned long memdebug_numblocks;
38extern unsigned long memdebug_total; 38extern unsigned long memdebug_total;
39extern unsigned long memdebug_maxmem;
39#endif 40#endif
40 41
41 42
diff --git a/ltests.c b/ltests.c
index 8d712796..b8a9e67d 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.8 2000/02/21 18:30:06 roberto Exp roberto $ 2** $Id: ltests.c,v 1.9 2000/03/10 18:37:44 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -33,6 +33,7 @@ void luaB_opentests (lua_State *L);
33static void mem_query (lua_State *L) { 33static void mem_query (lua_State *L) {
34 lua_pushnumber(L, memdebug_total); 34 lua_pushnumber(L, memdebug_total);
35 lua_pushnumber(L, memdebug_numblocks); 35 lua_pushnumber(L, memdebug_numblocks);
36 lua_pushnumber(L, memdebug_maxmem);
36} 37}
37 38
38 39