mirror of https://github.com/lua/lua
other distribution of memory debug information.
This commit is contained in:
parent
03160920cf
commit
00c122cc29
11
lbuiltin.c
11
lbuiltin.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lbuiltin.c,v 1.12 1997/11/27 18:25:14 roberto Exp roberto $
|
||||
** $Id: lbuiltin.c,v 1.13 1997/11/28 12:39:45 roberto Exp roberto $
|
||||
** Built-in functions
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -373,6 +373,13 @@ static void luaI_collectgarbage (void)
|
|||
*/
|
||||
#ifdef DEBUG
|
||||
|
||||
static void mem_query (void)
|
||||
{
|
||||
lua_pushnumber(totalmem);
|
||||
lua_pushnumber(numblocks);
|
||||
}
|
||||
|
||||
|
||||
static void testC (void)
|
||||
{
|
||||
#define getnum(s) ((*s++) - '0')
|
||||
|
@ -433,7 +440,7 @@ static struct luaL_reg int_funcs[] = {
|
|||
#endif
|
||||
#ifdef DEBUG
|
||||
{"testC", testC},
|
||||
{"totalmem", luaM_query},
|
||||
{"totalmem", mem_query},
|
||||
#endif
|
||||
{"assert", luaI_assert},
|
||||
{"call", luaI_call},
|
||||
|
|
14
lmem.c
14
lmem.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lmem.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $
|
||||
** $Id: lmem.c,v 1.2 1997/11/19 17:29:23 roberto Exp roberto $
|
||||
** Interface to Memory Manager
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -80,16 +80,8 @@ void *luaM_realloc (void *block, unsigned long size)
|
|||
|
||||
#define MARK 55
|
||||
|
||||
static unsigned long numblocks = 0;
|
||||
static unsigned long totalmem = 0;
|
||||
|
||||
|
||||
|
||||
void luaM_query (void)
|
||||
{
|
||||
lua_pushnumber(totalmem);
|
||||
lua_pushnumber(numblocks);
|
||||
}
|
||||
unsigned long numblocks = 0;
|
||||
unsigned long totalmem = 0;
|
||||
|
||||
|
||||
static void *checkblock (void *block)
|
||||
|
|
5
lmem.h
5
lmem.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lmem.h,v 1.2 1997/11/26 18:53:45 roberto Exp roberto $
|
||||
** $Id: lmem.h,v 1.3 1997/11/26 20:44:52 roberto Exp roberto $
|
||||
** Interface to Memory Manager
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -36,7 +36,8 @@ int luaM_growaux (void **block, unsigned long nelems, int size,
|
|||
|
||||
|
||||
#ifdef DEBUG
|
||||
void luaM_query (void);
|
||||
extern unsigned long numblocks;
|
||||
extern unsigned long totalmem;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue