diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-20 17:40:07 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-20 17:40:07 -0200 |
commit | 551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967 (patch) | |
tree | bde2f0e23706683829e87d4e239793de373444e7 /lstate.h | |
parent | 737f119187aca3c8f6743ec6e3cfc04e83723180 (diff) | |
download | lua-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.h | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 { | |||
114 | typedef struct global_State { | 114 | typedef 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 | |||
216 | LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); | ||
213 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | 217 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); |
214 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); | 218 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); |
215 | LUAI_FUNC void luaE_freeCI (lua_State *L); | 219 | LUAI_FUNC void luaE_freeCI (lua_State *L); |