ways to measure number of `blocks' for GC + details

This commit is contained in:
Roberto Ierusalimschy
1999-11-10 13:39:35 -02:00
parent 53fb65d394
commit d915cf4f9d
6 changed files with 35 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 1.12 1999/10/04 17:51:04 roberto Exp roberto $
** $Id: lfunc.c,v 1.13 1999/10/14 19:46:57 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@@ -11,8 +11,8 @@
#include "lmem.h"
#include "lstate.h"
#define gcsizeproto(p) 5 /* approximate "weight" for a prototype */
#define gcsizeclosure(c) 1 /* approximate "weight" for a closure */
#define gcsizeproto(p) numblocks(0, sizeof(TProtoFunc))
#define gcsizeclosure(c) numblocks(c->nelems, sizeof(Closure))
@@ -21,8 +21,8 @@ Closure *luaF_newclosure (int nelems) {
c->next = L->rootcl;
L->rootcl = c;
c->marked = 0;
L->nblocks += gcsizeclosure(c);
c->nelems = nelems;
L->nblocks += gcsizeclosure(c);
return c;
}