aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-29 15:41:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-29 15:41:07 -0300
commit8dea54877a5e7b0a461b076e79fdc8b47d7e39e6 (patch)
tree7c7c093a19405b4ab2428bdfc00a0a4acaf81893 /lgc.c
parentb5ab31a475ccf5f96c2ffb34fccc1d6592913794 (diff)
downloadlua-8dea54877a5e7b0a461b076e79fdc8b47d7e39e6.tar.gz
lua-8dea54877a5e7b0a461b076e79fdc8b47d7e39e6.tar.bz2
lua-8dea54877a5e7b0a461b076e79fdc8b47d7e39e6.zip
Do not avoid major collections when GCdebt is zero
'collectgarbage("step")' (without an argument) does not have any special meaning, it means "do a step with some default size".
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lgc.c b/lgc.c
index 27856650..f68c5af0 100644
--- a/lgc.c
+++ b/lgc.c
@@ -9,7 +9,6 @@
9 9
10#include "lprefix.h" 10#include "lprefix.h"
11 11
12#include <stdio.h>
13#include <string.h> 12#include <string.h>
14 13
15 14
@@ -1377,14 +1376,12 @@ static void genmajorstep (lua_State *L, global_State *g) {
1377/* 1376/*
1378** Does a generational "step". If the total number of objects grew 1377** Does a generational "step". If the total number of objects grew
1379** more than 'majormul'% since the last major collection, does a 1378** more than 'majormul'% since the last major collection, does a
1380** major collection. Otherwise, does a minor collection. The test 1379** major collection. Otherwise, does a minor collection.
1381** ('GCdebt' != 0) avoids major collections when the step originated from
1382** 'collectgarbage("step")'.
1383*/ 1380*/
1384static void genstep (lua_State *L, global_State *g) { 1381static void genstep (lua_State *L, global_State *g) {
1385 l_obj majorbase = g->GClastmajor; /* count after last major collection */ 1382 l_obj majorbase = g->GClastmajor; /* count after last major collection */
1386 l_obj majorinc = applygcparam(g, genmajormul, majorbase); 1383 l_obj majorinc = applygcparam(g, genmajormul, majorbase);
1387 if (g->GCdebt != 0 && gettotalobjs(g) > majorbase + majorinc) { 1384 if (gettotalobjs(g) > majorbase + majorinc && 0) {
1388 /* do a major collection */ 1385 /* do a major collection */
1389 enterinc(g); 1386 enterinc(g);
1390 g->gckind = KGC_GENMAJOR; 1387 g->gckind = KGC_GENMAJOR;