new way to count `nblocks' for GC (try to count bytes).

This commit is contained in:
Roberto Ierusalimschy
2000-09-29 09:42:13 -03:00
parent ca7fd50a4e
commit dad808a73a
18 changed files with 95 additions and 63 deletions

4
ltm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ltm.c,v 1.48 2000/09/11 19:45:27 roberto Exp roberto $
** $Id: ltm.c,v 1.49 2000/09/11 20:29:27 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -77,6 +77,7 @@ static void init_entry (lua_State *L, int tag) {
void luaT_init (lua_State *L) {
int t;
luaM_growvector(L, L->IMtable, 0, NUM_TAGS, struct IM, "", MAX_INT);
L->nblocks += NUM_TAGS*sizeof(struct IM);
L->last_tag = NUM_TAGS-1;
for (t=0; t<=L->last_tag; t++)
init_entry(L, t);
@@ -86,6 +87,7 @@ void luaT_init (lua_State *L) {
int lua_newtag (lua_State *L) {
luaM_growvector(L, L->IMtable, L->last_tag, 1, struct IM,
"tag table overflow", MAX_INT);
L->nblocks += sizeof(struct IM);
L->last_tag++;
init_entry(L, L->last_tag);
return L->last_tag;