summaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-04-19 13:33:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-04-19 13:33:19 -0300
commit1bb407e494072b2fb05efcf53af3eb100abe981d (patch)
treee35f54590beb4bd9c8c4e3f061da84a6bd4f1c9d /lapi.c
parent53f9499f7f7bf1fb41a37382ffef8a6796a528c1 (diff)
downloadlua-1bb407e494072b2fb05efcf53af3eb100abe981d.tar.gz
lua-1bb407e494072b2fb05efcf53af3eb100abe981d.tar.bz2
lua-1bb407e494072b2fb05efcf53af3eb100abe981d.zip
in lua_gc/step, 'luaC_step' changes GCthreshold, so there was little
control over the real step size.
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index b56f8c85..39934790 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.121 2010/04/13 20:48:12 roberto Exp roberto $ 2** $Id: lapi.c,v 2.122 2010/04/18 13:22:48 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*/
@@ -940,9 +940,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
940 luaC_step(L); /* do a single step */ 940 luaC_step(L); /* do a single step */
941 } 941 }
942 else { 942 else {
943 lu_mem a = (cast(lu_mem, data) << 10); 943 while (data-- >= 0) {
944 g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0;
945 while (g->GCthreshold <= g->totalbytes) {
946 luaC_step(L); 944 luaC_step(L);
947 if (g->gcstate == GCSpause) { /* end of cycle? */ 945 if (g->gcstate == GCSpause) { /* end of cycle? */
948 res = 1; /* signal it */ 946 res = 1; /* signal it */