mirror of
https://github.com/lua/lua
synced 2025-04-19 11:22:48 +03:00
in lua_gc/step, 'luaC_step' changes GCthreshold, so there was little
control over the real step size.
This commit is contained in:
parent
53f9499f7f
commit
1bb407e494
6
lapi.c
6
lapi.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.121 2010/04/13 20:48:12 roberto Exp roberto $
|
** $Id: lapi.c,v 2.122 2010/04/18 13:22:48 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -940,9 +940,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
|
|||||||
luaC_step(L); /* do a single step */
|
luaC_step(L); /* do a single step */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lu_mem a = (cast(lu_mem, data) << 10);
|
while (data-- >= 0) {
|
||||||
g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0;
|
|
||||||
while (g->GCthreshold <= g->totalbytes) {
|
|
||||||
luaC_step(L);
|
luaC_step(L);
|
||||||
if (g->gcstate == GCSpause) { /* end of cycle? */
|
if (g->gcstate == GCSpause) { /* end of cycle? */
|
||||||
res = 1; /* signal it */
|
res = 1; /* signal it */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user