diff options
-rw-r--r-- | lmem.c | 4 | ||||
-rw-r--r-- | lmem.h | 3 | ||||
-rw-r--r-- | ltests.c | 3 |
3 files changed, 7 insertions, 3 deletions
@@ -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 | ||
55 | unsigned long memdebug_numblocks = 0; | 55 | unsigned long memdebug_numblocks = 0; |
56 | unsigned long memdebug_total = 0; | 56 | unsigned long memdebug_total = 0; |
57 | unsigned long memdebug_maxmem = 0; | ||
57 | 58 | ||
58 | 59 | ||
59 | static void *checkblock (void *block) { | 60 | static 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++) |
@@ -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 |
37 | extern unsigned long memdebug_numblocks; | 37 | extern unsigned long memdebug_numblocks; |
38 | extern unsigned long memdebug_total; | 38 | extern unsigned long memdebug_total; |
39 | extern unsigned long memdebug_maxmem; | ||
39 | #endif | 40 | #endif |
40 | 41 | ||
41 | 42 | ||
@@ -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); | |||
33 | static void mem_query (lua_State *L) { | 33 | static 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 | ||