diff options
| -rw-r--r-- | lbuiltin.c | 11 | ||||
| -rw-r--r-- | lmem.c | 14 | ||||
| -rw-r--r-- | lmem.h | 5 |
3 files changed, 15 insertions, 15 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.12 1997/11/27 18:25:14 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.13 1997/11/28 12:39:45 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -373,6 +373,13 @@ static void luaI_collectgarbage (void) | |||
| 373 | */ | 373 | */ |
| 374 | #ifdef DEBUG | 374 | #ifdef DEBUG |
| 375 | 375 | ||
| 376 | static void mem_query (void) | ||
| 377 | { | ||
| 378 | lua_pushnumber(totalmem); | ||
| 379 | lua_pushnumber(numblocks); | ||
| 380 | } | ||
| 381 | |||
| 382 | |||
| 376 | static void testC (void) | 383 | static void testC (void) |
| 377 | { | 384 | { |
| 378 | #define getnum(s) ((*s++) - '0') | 385 | #define getnum(s) ((*s++) - '0') |
| @@ -433,7 +440,7 @@ static struct luaL_reg int_funcs[] = { | |||
| 433 | #endif | 440 | #endif |
| 434 | #ifdef DEBUG | 441 | #ifdef DEBUG |
| 435 | {"testC", testC}, | 442 | {"testC", testC}, |
| 436 | {"totalmem", luaM_query}, | 443 | {"totalmem", mem_query}, |
| 437 | #endif | 444 | #endif |
| 438 | {"assert", luaI_assert}, | 445 | {"assert", luaI_assert}, |
| 439 | {"call", luaI_call}, | 446 | {"call", luaI_call}, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.2 1997/11/19 17:29:23 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 | */ |
| @@ -80,16 +80,8 @@ void *luaM_realloc (void *block, unsigned long size) | |||
| 80 | 80 | ||
| 81 | #define MARK 55 | 81 | #define MARK 55 |
| 82 | 82 | ||
| 83 | static unsigned long numblocks = 0; | 83 | unsigned long numblocks = 0; |
| 84 | static unsigned long totalmem = 0; | 84 | unsigned long totalmem = 0; |
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | void luaM_query (void) | ||
| 89 | { | ||
| 90 | lua_pushnumber(totalmem); | ||
| 91 | lua_pushnumber(numblocks); | ||
| 92 | } | ||
| 93 | 85 | ||
| 94 | 86 | ||
| 95 | static void *checkblock (void *block) | 87 | static void *checkblock (void *block) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.2 1997/11/26 18:53:45 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.3 1997/11/26 20:44:52 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,7 +36,8 @@ int luaM_growaux (void **block, unsigned long nelems, int size, | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | #ifdef DEBUG | 38 | #ifdef DEBUG |
| 39 | void luaM_query (void); | 39 | extern unsigned long numblocks; |
| 40 | extern unsigned long totalmem; | ||
| 40 | #endif | 41 | #endif |
| 41 | 42 | ||
| 42 | 43 | ||
