more information about memory use

This commit is contained in:
Roberto Ierusalimschy
2000-03-16 17:35:07 -03:00
parent 06f08f5634
commit 87367e97f3
3 changed files with 7 additions and 3 deletions

4
lmem.c
View File

@@ -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++)