Added a counter of the total number of existing objects

It may simplify the control of the garbage collector.
This commit is contained in:
Roberto Ierusalimschy
2022-11-03 16:37:13 -03:00
parent 3d2bd1359d
commit 76953316d1
3 changed files with 5 additions and 0 deletions

View File

@@ -250,6 +250,7 @@ typedef struct global_State {
lua_Alloc frealloc; /* function to reallocate memory */
void *ud; /* auxiliary data to 'frealloc' */
l_mem totalbytes; /* number of bytes currently allocated - GCdebt */
l_mem totalobjs; /* total number of objects allocated */
l_mem GCdebt; /* bytes allocated not yet compensated by the collector */
lu_mem GCestimate; /* an estimate of the non-garbage memory in use */
lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */