mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
better name for GC pause
This commit is contained in:
parent
ad24cff0f1
commit
390256edf7
8
lapi.c
8
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 2.34 2005/03/18 20:11:28 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 2.35 2005/03/21 18:12:21 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -913,9 +913,9 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
|
||||
res = 1; /* signal it */
|
||||
break;
|
||||
}
|
||||
case LUA_GCSETPACE: {
|
||||
res = g->gcpace;
|
||||
g->gcpace = data;
|
||||
case LUA_GCSETPAUSE: {
|
||||
res = g->gcpause;
|
||||
g->gcpause = data;
|
||||
break;
|
||||
}
|
||||
case LUA_GCSETSTEPMUL: {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lbaselib.c,v 1.170 2005/03/11 15:51:08 roberto Exp roberto $
|
||||
** $Id: lbaselib.c,v 1.171 2005/03/16 16:58:41 roberto Exp roberto $
|
||||
** Basic library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -187,9 +187,9 @@ static int luaB_gcinfo (lua_State *L) {
|
||||
|
||||
static int luaB_collectgarbage (lua_State *L) {
|
||||
static const char *const opts[] = {"stop", "restart", "collect",
|
||||
"count", "step", "setpace", "setstepmul", NULL};
|
||||
"count", "step", "setpause", "setstepmul", NULL};
|
||||
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
|
||||
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPACE, LUA_GCSETSTEPMUL};
|
||||
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
|
||||
int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts);
|
||||
int ex = luaL_optinteger(L, 2, 0);
|
||||
luaL_argcheck(L, o >= 0, 1, "invalid option");
|
||||
|
4
lgc.c
4
lgc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 2.29 2005/03/09 16:28:07 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.30 2005/03/16 17:00:21 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -57,7 +57,7 @@
|
||||
reallymarkobject(g, obj2gco(t)); }
|
||||
|
||||
|
||||
#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpace)
|
||||
#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause)
|
||||
|
||||
|
||||
static void removeentry (Node *n) {
|
||||
|
6
lstate.c
6
lstate.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.c,v 2.26 2005/03/18 18:02:04 roberto Exp roberto $
|
||||
** $Id: lstate.c,v 2.27 2005/03/18 18:55:45 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -170,8 +170,8 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
|
||||
g->weak = NULL;
|
||||
g->tmudata = NULL;
|
||||
g->totalbytes = sizeof(LG);
|
||||
g->gcpace = 200; /* 200% (wait memory to double before next collection) */
|
||||
g->gcstepmul = 200; /* GC runs `twice the speed' of memory allocation */
|
||||
g->gcpause = LUAI_GCPAUSE;
|
||||
g->gcstepmul = LUAI_GCMUL;
|
||||
g->gcdept = 0;
|
||||
if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
|
||||
/* memory allocation error: free partial state */
|
||||
|
4
lstate.h
4
lstate.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.h,v 2.16 2005/02/23 17:30:22 roberto Exp roberto $
|
||||
** $Id: lstate.h,v 2.17 2005/03/18 18:55:09 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -83,7 +83,7 @@ typedef struct global_State {
|
||||
lu_mem totalbytes; /* number of bytes currently allocated */
|
||||
lu_mem estimate; /* an estimate of number of bytes actually in use */
|
||||
lu_mem gcdept; /* how much GC is `behind schedule' */
|
||||
int gcpace; /* size of pause between successive GCs */
|
||||
int gcpause; /* size of pause between successive GCs */
|
||||
int gcstepmul; /* GC `granularity' */
|
||||
lua_CFunction panic; /* to be called in unprotected errors */
|
||||
TValue _registry;
|
||||
|
4
lua.h
4
lua.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lua.h,v 1.201 2005/01/17 23:50:55 roberto Exp roberto $
|
||||
** $Id: lua.h,v 1.202 2005/02/18 12:40:02 roberto Exp roberto $
|
||||
** Lua - An Extensible Extension Language
|
||||
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
** http://www.lua.org mailto:info@lua.org
|
||||
@ -227,7 +227,7 @@ LUA_API int (lua_status) (lua_State *L);
|
||||
#define LUA_GCCOLLECT 2
|
||||
#define LUA_GCCOUNT 3
|
||||
#define LUA_GCSTEP 4
|
||||
#define LUA_GCSETPACE 5
|
||||
#define LUA_GCSETPAUSE 5
|
||||
#define LUA_GCSETSTEPMUL 6
|
||||
|
||||
LUA_API int (lua_gc) (lua_State *L, int what, int data);
|
||||
|
Loading…
Reference in New Issue
Block a user