aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-12-20 17:40:07 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-12-20 17:40:07 -0200
commit551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967 (patch)
treebde2f0e23706683829e87d4e239793de373444e7 /lstate.h
parent737f119187aca3c8f6743ec6e3cfc04e83723180 (diff)
downloadlua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.tar.gz
lua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.tar.bz2
lua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.zip
change in the relationship between totalbytes and GCdebt - luaM_realloc_
is too critical to update two counters
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/lstate.h b/lstate.h
index fd1b2d66..6bf691b2 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.69 2010/11/26 14:32:31 roberto Exp roberto $ 2** $Id: lstate.h,v 2.70 2010/12/20 18:17:46 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -114,8 +114,8 @@ typedef struct CallInfo {
114typedef struct global_State { 114typedef struct global_State {
115 lua_Alloc frealloc; /* function to reallocate memory */ 115 lua_Alloc frealloc; /* function to reallocate memory */
116 void *ud; /* auxiliary data to `frealloc' */ 116 void *ud; /* auxiliary data to `frealloc' */
117 lu_mem totalbytes; /* number of bytes currently allocated */ 117 lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */
118 l_mem GCdebt; /* when positive, run a GC step */ 118 l_mem GCdebt; /* bytes allocated not yet compensated by the collector */
119 lu_mem lastmajormem; /* memory in use after last major collection */ 119 lu_mem lastmajormem; /* memory in use after last major collection */
120 stringtable strt; /* hash table for strings */ 120 stringtable strt; /* hash table for strings */
121 TValue l_registry; 121 TValue l_registry;
@@ -210,6 +210,10 @@ union GCObject {
210#define obj2gco(v) (cast(GCObject *, (v))) 210#define obj2gco(v) (cast(GCObject *, (v)))
211 211
212 212
213/* actual number of total bytes allocated */
214#define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt)
215
216LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
213LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); 217LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
214LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); 218LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
215LUAI_FUNC void luaE_freeCI (lua_State *L); 219LUAI_FUNC void luaE_freeCI (lua_State *L);