lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 87367e97f3c37796bb1ed4ec3e8f0b0df3b8d70e
parent 06f08f5634158e2ae1e8964c0e4248d8bae0db8a
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 16 Mar 2000 17:34:45 -0300

more information about memory use

Diffstat:
Mlmem.c | 4+++-
Mlmem.h | 3++-
Mltests.c | 3++-
3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lmem.c b/lmem.c @@ -1,5 +1,5 @@ /* -** $Id: lmem.c,v 1.27 2000/03/10 14:01:05 roberto Exp roberto $ +** $Id: lmem.c,v 1.28 2000/03/10 18:37:44 roberto Exp roberto $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -54,6 +54,7 @@ unsigned long memdebug_numblocks = 0; unsigned long memdebug_total = 0; +unsigned long memdebug_maxmem = 0; static void *checkblock (void *block) { @@ -95,6 +96,7 @@ static void *debug_realloc (void *block, size_t size) { freeblock(block); /* erase (and check) old copy */ } memdebug_total += size; + if (memdebug_total > memdebug_maxmem) memdebug_maxmem = memdebug_total; memdebug_numblocks++; *(unsigned long *)newblock = size; for (i=0;i<MARKSIZE;i++) diff --git a/lmem.h b/lmem.h @@ -1,5 +1,5 @@ /* -** $Id: lmem.h,v 1.11 1999/12/27 17:33:22 roberto Exp roberto $ +** $Id: lmem.h,v 1.12 2000/01/13 16:30:47 roberto Exp roberto $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -36,6 +36,7 @@ void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, in #ifdef DEBUG extern unsigned long memdebug_numblocks; extern unsigned long memdebug_total; +extern unsigned long memdebug_maxmem; #endif diff --git a/ltests.c b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.8 2000/02/21 18:30:06 roberto Exp roberto $ +** $Id: ltests.c,v 1.9 2000/03/10 18:37:44 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -33,6 +33,7 @@ void luaB_opentests (lua_State *L); static void mem_query (lua_State *L) { lua_pushnumber(L, memdebug_total); lua_pushnumber(L, memdebug_numblocks); + lua_pushnumber(L, memdebug_maxmem); }