mirror of https://github.com/rusefi/lua.git
ensures that "collectgarbage'step'" in generational mode does a
minor collection
This commit is contained in:
parent
69371c4b84
commit
f399e6705f
13
lgc.c
13
lgc.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lgc.c,v 2.224 2017/04/20 18:24:33 roberto Exp roberto $
|
** $Id: lgc.c,v 2.225 2017/04/24 16:59:26 roberto Exp $
|
||||||
** Garbage Collector
|
** Garbage Collector
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -1202,13 +1202,18 @@ static void fullgen (lua_State *L, global_State *g) {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Does a generational "step". For now that means a young
|
** Does a generational "step". If memory grows 'genmajormul'% larger
|
||||||
** collection. (We still has to implement the full control.)
|
** than last major collection (kept in 'g->GCestimate'), does a major
|
||||||
|
** collection. Otherwise, does a minor collection and set debt to make
|
||||||
|
** another collection when memory grows 'genminormul'% larger.
|
||||||
|
** 'GCdebt <= 0' means an explicity call to GC step with "size" zero;
|
||||||
|
** in that case, always do a minor collection.
|
||||||
*/
|
*/
|
||||||
static void genstep (lua_State *L, global_State *g) {
|
static void genstep (lua_State *L, global_State *g) {
|
||||||
lu_mem majorbase = g->GCestimate;
|
lu_mem majorbase = g->GCestimate;
|
||||||
//lua_checkmemory(L);
|
//lua_checkmemory(L);
|
||||||
if (gettotalbytes(g) > (majorbase / 100) * (100 + g->genmajormul)) {
|
if (g->GCdebt > 0 &&
|
||||||
|
gettotalbytes(g) > (majorbase / 100) * (100 + g->genmajormul)) {
|
||||||
fullgen(L, g);
|
fullgen(L, g);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue