Add LUA_GCCOUNTB option for lua_gc (#254)

Co-authored-by: Petri Häkkinen <petrih@rmd.remedy.fi>
This commit is contained in:
Petri Häkkinen 2021-11-30 18:14:12 +02:00 committed by GitHub
parent f86d4c6995
commit 9aa9ff12dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -231,6 +231,7 @@ enum lua_GCOp
LUA_GCRESTART,
LUA_GCCOLLECT,
LUA_GCCOUNT,
LUA_GCCOUNTB,
LUA_GCISRUNNING,
// garbage collection is handled by 'assists' that perform some amount of GC work matching pace of allocation

View File

@ -1039,6 +1039,11 @@ int lua_gc(lua_State* L, int what, int data)
res = cast_int(g->totalbytes >> 10);
break;
}
case LUA_GCCOUNTB:
{
res = cast_int(g->totalbytes & 1023);
break;
}
case LUA_GCISRUNNING:
{
res = (g->GCthreshold != SIZE_MAX);