summaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-04 12:30:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-04 12:30:53 -0300
commit345379b5ff7ce6f5a732a6954bfb5e83bce12036 (patch)
tree2d55667999fe8e4d5986ab8cc13eaeb837657642 /lapi.c
parent118e471fa0fd9db1c3a4b966a4312f65d4aa33a7 (diff)
downloadlua-345379b5ff7ce6f5a732a6954bfb5e83bce12036.tar.gz
lua-345379b5ff7ce6f5a732a6954bfb5e83bce12036.tar.bz2
lua-345379b5ff7ce6f5a732a6954bfb5e83bce12036.zip
option for garbage-collector `step'
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lapi.c b/lapi.c
index ab0278b4..f5b080fa 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.9 2004/05/14 19:25:09 roberto Exp roberto $ 2** $Id: lapi.c,v 2.10 2004/05/31 19:41:52 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -833,6 +833,15 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
833 /* GC values are expressed in Kbytes: #bytes/2^10 */ 833 /* GC values are expressed in Kbytes: #bytes/2^10 */
834 return cast(int, g->nblocks >> 10); 834 return cast(int, g->nblocks >> 10);
835 } 835 }
836 case LUA_GCSTEP: {
837 lu_mem a = (cast(lu_mem, data) << 10);
838 if (a <= g->nblocks)
839 g->GCthreshold = g->nblocks - a;
840 else
841 g->GCthreshold = 0;
842 luaC_step(L);
843 return 0;
844 }
836 default: return -1; /* invalid option */ 845 default: return -1; /* invalid option */
837 } 846 }
838} 847}