2 ** $Id: lstate.c,v 1.12 1999/05/11 20:08:20 roberto Exp $
4 ** See Copyright Notice in lua.h
20 lua_State
*lua_state
= NULL
;
25 if (lua_state
) return;
26 lua_state
= luaM_new(lua_State
);
40 L
->rootproto
.next
= NULL
;
41 L
->rootproto
.marked
= 0;
42 L
->rootcl
.next
= NULL
;
44 L
->rootglobal
.next
= NULL
;
45 L
->rootglobal
.marked
= 0;
46 L
->roottable
.next
= NULL
;
47 L
->roottable
.marked
= 0;
51 L
->GCthreshold
= GARBAGE_BLOCK
;
63 TaggedString
*alludata
= luaS_collectudata();
64 L
->GCthreshold
= MAX_INT
; /* to avoid GC during GC */
65 luaC_hashcallIM((Hash
*)L
->roottable
.next
); /* GC t.methods for tables */
66 luaC_strcallIM(alludata
); /* GC tag methods for userdata */
67 luaD_gcIM(&luaO_nilobject
); /* GC tag method for nil (signal end of GC) */
68 luaH_free((Hash
*)L
->roottable
.next
);
69 luaF_freeproto((TProtoFunc
*)L
->rootproto
.next
);
70 luaF_freeclosure((Closure
*)L
->rootcl
.next
);
73 luaM_free(L
->stack
.stack
);
74 luaM_free(L
->IMtable
);
75 luaM_free(L
->refArray
);
76 luaM_free(L
->Mbuffer
);
77 luaM_free(L
->Cblocks
);
81 printf("total de blocos: %ld\n", numblocks
);
82 printf("total de memoria: %ld\n", totalmem
);