diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-02 17:31:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-02 17:31:17 -0300 |
commit | b97fb932ece7872a8d1dd6c0a2c88f3ce33e9741 (patch) | |
tree | d9e60044a35ad3fdf761f28506be08205081ebd7 /ltests.h | |
parent | c7cf92e6f318823406e40ad6016e5ccb4e041c72 (diff) | |
download | lua-b97fb932ece7872a8d1dd6c0a2c88f3ce33e9741.tar.gz lua-b97fb932ece7872a8d1dd6c0a2c88f3ce33e9741.tar.bz2 lua-b97fb932ece7872a8d1dd6c0a2c88f3ce33e9741.zip |
Lua kernel does not use malloc/free functions.
Diffstat (limited to 'ltests.h')
-rw-r--r-- | ltests.h | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 1.19 2002/11/19 17:42:32 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 1.20 2002/12/04 17:29:05 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -27,16 +27,20 @@ | |||
27 | 27 | ||
28 | 28 | ||
29 | /* memory allocator control variables */ | 29 | /* memory allocator control variables */ |
30 | extern unsigned long memdebug_numblocks; | 30 | typedef struct Memcontrol { |
31 | extern unsigned long memdebug_total; | 31 | unsigned long numblocks; |
32 | extern unsigned long memdebug_maxmem; | 32 | unsigned long total; |
33 | extern unsigned long memdebug_memlimit; | 33 | unsigned long maxmem; |
34 | unsigned long memlimit; | ||
35 | } Memcontrol; | ||
34 | 36 | ||
37 | extern Memcontrol memcontrol; | ||
35 | 38 | ||
36 | #define l_realloc(b, os, s) debug_realloc(b, os, s) | 39 | void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); |
37 | #define l_free(b, os) debug_realloc(b, os, 0) | ||
38 | 40 | ||
39 | void *debug_realloc (void *block, size_t oldsize, size_t size); | 41 | #ifdef lua_c |
42 | #define luaL_newstate() lua_newstate(debug_realloc, &memcontrol) | ||
43 | #endif | ||
40 | 44 | ||
41 | 45 | ||
42 | 46 | ||