aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-01 18:30:44 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-01 18:30:44 -0200
commit00c122cc291cfb24e01a5c00f2c3503a6dfa073e (patch)
treed0bb5d6abe27967640f87cca5db9dcaf62cde62d
parent03160920cf51a06bbb4406ec5ddb4f5dd52f0d7c (diff)
downloadlua-00c122cc291cfb24e01a5c00f2c3503a6dfa073e.tar.gz
lua-00c122cc291cfb24e01a5c00f2c3503a6dfa073e.tar.bz2
lua-00c122cc291cfb24e01a5c00f2c3503a6dfa073e.zip
other distribution of memory debug information.
-rw-r--r--lbuiltin.c11
-rw-r--r--lmem.c14
-rw-r--r--lmem.h5
3 files changed, 15 insertions, 15 deletions
diff --git a/lbuiltin.c b/lbuiltin.c
index 37457d0d..5d6274c3 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -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
376static void mem_query (void)
377{
378 lua_pushnumber(totalmem);
379 lua_pushnumber(numblocks);
380}
381
382
376static void testC (void) 383static 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},
diff --git a/lmem.c b/lmem.c
index 749fca5b..069c4d0d 100644
--- a/lmem.c
+++ b/lmem.c
@@ -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
83static unsigned long numblocks = 0; 83unsigned long numblocks = 0;
84static unsigned long totalmem = 0; 84unsigned long totalmem = 0;
85
86
87
88void luaM_query (void)
89{
90 lua_pushnumber(totalmem);
91 lua_pushnumber(numblocks);
92}
93 85
94 86
95static void *checkblock (void *block) 87static void *checkblock (void *block)
diff --git a/lmem.h b/lmem.h
index 8d4bd32c..ac7ba9ae 100644
--- a/lmem.h
+++ b/lmem.h
@@ -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
39void luaM_query (void); 39extern unsigned long numblocks;
40extern unsigned long totalmem;
40#endif 41#endif
41 42
42 43