diff options
author | Lua Team <team@lua.org> | 2000-11-06 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2000-11-06 12:00:00 +0000 |
commit | 8cb71cb5548e3138e5d4e4744f52c79d9fafb116 (patch) | |
tree | 25859eb162c67eafc46866e0ec3a9a7ebf93157a /src/lmem.h | |
parent | b7610da5fed99f59ac73ae452da8839a0f2c1bda (diff) | |
download | lua-github-4.0.tar.gz |
Lua 4.04.0
Diffstat (limited to 'src/lmem.h')
-rw-r--r-- | src/lmem.h | 45 |
1 files changed, 23 insertions, 22 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lmem.h,v 1.8 1999/02/26 15:48:55 roberto Exp $ +** $Id: lmem.h,v 1.16 2000/10/30 16:29:59 roberto Exp $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -8,32 +8,33 @@ #define lmem_h -#include <stdlib.h> +#include <stddef.h> -/* memory error messages */ -#define codeEM "code size overflow" -#define constantEM "constant table overflow" -#define refEM "reference table overflow" -#define tableEM "table overflow" -#define memEM "not enough memory" -#define arrEM "internal array bigger than `int' limit" +#include "llimits.h" +#include "lua.h" -void *luaM_realloc (void *oldblock, unsigned long size); -void *luaM_growaux (void *block, unsigned long nelems, int inc, int size, - char *errormsg, unsigned long limit); +void *luaM_realloc (lua_State *L, void *oldblock, lint32 size); +void *luaM_growaux (lua_State *L, void *block, size_t nelems, + int inc, size_t size, const char *errormsg, + size_t limit); -#define luaM_free(b) luaM_realloc((b), 0) -#define luaM_malloc(t) luaM_realloc(NULL, (t)) -#define luaM_new(t) ((t *)luaM_malloc(sizeof(t))) -#define luaM_newvector(n,t) ((t *)luaM_malloc((n)*sizeof(t))) -#define luaM_growvector(v,nelems,inc,t,e,l) \ - ((v)=(t *)luaM_growaux(v,nelems,inc,sizeof(t),e,l)) -#define luaM_reallocvector(v,n,t) ((v)=(t *)luaM_realloc(v,(n)*sizeof(t))) +#define luaM_free(L, b) luaM_realloc(L, (b), 0) +#define luaM_malloc(L, t) luaM_realloc(L, NULL, (t)) +#define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, (n)*(lint32)sizeof(t))) +#define luaM_growvector(L, v,nelems,inc,t,e,l) \ + ((v)=(t *)luaM_growaux(L, v,nelems,inc,sizeof(t),e,l)) -#ifdef DEBUG -extern unsigned long numblocks; -extern unsigned long totalmem; +#define luaM_reallocvector(L, v,n,t) \ + ((v)=(t *)luaM_realloc(L, v,(n)*(lint32)sizeof(t))) + + +#ifdef LUA_DEBUG +extern unsigned long memdebug_numblocks; +extern unsigned long memdebug_total; +extern unsigned long memdebug_maxmem; +extern unsigned long memdebug_memlimit; #endif |