mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Rename of fields in global state that control GC
All fields in the global state that control the pace of the garbage collector prefixed with 'GC'.
This commit is contained in:
parent
007b8c7a01
commit
a04e0ffdb9
5 changed files with 32 additions and 32 deletions
8
lmem.c
8
lmem.c
|
|
@ -151,7 +151,7 @@ void luaM_free_ (lua_State *L, void *block, size_t osize) {
|
|||
global_State *g = G(L);
|
||||
lua_assert((osize == 0) == (block == NULL));
|
||||
callfrealloc(g, block, osize, 0);
|
||||
g->totalbytes -= osize;
|
||||
g->GCtotalbytes -= osize;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -181,10 +181,10 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
|
|||
if (l_unlikely(newblock == NULL && nsize > 0)) {
|
||||
newblock = tryagain(L, block, osize, nsize);
|
||||
if (newblock == NULL) /* still no memory? */
|
||||
return NULL; /* do not update 'totalbytes' */
|
||||
return NULL; /* do not update 'GCtotalbytes' */
|
||||
}
|
||||
lua_assert((nsize == 0) == (newblock == NULL));
|
||||
g->totalbytes += nsize - osize;
|
||||
g->GCtotalbytes += nsize - osize;
|
||||
return newblock;
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ void *luaM_malloc_ (lua_State *L, size_t size, int tag) {
|
|||
if (newblock == NULL)
|
||||
luaM_error(L);
|
||||
}
|
||||
g->totalbytes += size;
|
||||
g->GCtotalbytes += size;
|
||||
return newblock;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue