From 345379b5ff7ce6f5a732a6954bfb5e83bce12036 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 4 Jun 2004 12:30:53 -0300 Subject: option for garbage-collector `step' --- lapi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index ab0278b4..f5b080fa 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.9 2004/05/14 19:25:09 roberto Exp roberto $ +** $Id: lapi.c,v 2.10 2004/05/31 19:41:52 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -833,6 +833,15 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { /* GC values are expressed in Kbytes: #bytes/2^10 */ return cast(int, g->nblocks >> 10); } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->nblocks) + g->GCthreshold = g->nblocks - a; + else + g->GCthreshold = 0; + luaC_step(L); + return 0; + } default: return -1; /* invalid option */ } } -- cgit v1.2.3-55-g6feb