From ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 19 Sep 2024 19:02:14 -0300 Subject: GC back to controling pace counting bytes Memory is the resource we want to save. Still to be reviewed again. --- lstate.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index 6aa02889..2a03576d 100644 --- a/lstate.h +++ b/lstate.h @@ -274,11 +274,10 @@ struct CallInfo { typedef struct global_State { lua_Alloc frealloc; /* function to reallocate memory */ void *ud; /* auxiliary data to 'frealloc' */ - lu_mem GCtotalbytes; /* number of bytes currently allocated */ - l_obj GCtotalobjs; /* total number of objects allocated + GCdebt */ - l_obj GCdebt; /* objects counted but not yet allocated */ - l_obj GCmarked; /* number of objects marked in a GC cycle */ - l_obj GCmajorminor; /* auxiliary counter to control major-minor shifts */ + l_mem GCtotalbytes; /* number of bytes currently allocated + debt */ + l_mem GCdebt; /* bytes counted but not yet allocated */ + l_mem GCmarked; /* number of objects marked in a GC cycle */ + l_mem GCmajorminor; /* auxiliary counter to control major-minor shifts */ stringtable strt; /* hash table for strings */ TValue l_registry; TValue nilvalue; /* a nil value */ @@ -411,11 +410,11 @@ union GCUnion { #define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) -/* actual number of total objects allocated */ -#define gettotalobjs(g) ((g)->GCtotalobjs - (g)->GCdebt) +/* actual number of total memory allocated */ +#define gettotalbytes(g) ((g)->GCtotalbytes - (g)->GCdebt) -LUAI_FUNC void luaE_setdebt (global_State *g, l_obj debt); +LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); LUAI_FUNC void luaE_shrinkCI (lua_State *L); -- cgit v1.2.3-55-g6feb