Option 0 for step multiplier makes GC non-incremental

This commit is contained in:
Roberto Ierusalimschy
2023-12-20 11:06:27 -03:00
parent 4eda1acafa
commit 666e95a66d
6 changed files with 84 additions and 50 deletions

View File

@@ -664,7 +664,7 @@ Values equal to or less than 100 mean the collector will not wait to
start a new cycle.
A value of 200 means that the collector waits for
the total number of objects to double before starting a new cycle.
The default value is 200; the maximum value is 1000.
The default value is 300; the maximum value is 1000.
The garbage-collector step multiplier
controls the speed of the collector relative to
@@ -674,7 +674,9 @@ how many objects it marks or sweeps for each object created.
Larger values make the collector more aggressive.
Beware that values too small can
make the collector too slow to ever finish a cycle.
The default value is 300; the maximum value is 1000.
The default value is 200; the maximum value is 1000.
As a special case, a zero value means unlimited work,
effectively producing a non-incremental, stop-the-world collector.
The garbage-collector step size controls the
size of each incremental step,
@@ -682,9 +684,7 @@ specifically how many objects the interpreter creates
before performing a step.
This parameter is logarithmic:
A value of @M{n} means the interpreter will create @M{2@sp{n}}
objects between steps and perform equivalent work during the step.
A large value (e.g., 60) makes the collector a stop-the-world
(non-incremental) collector.
objects between steps.
The default value is 8,
which means steps of approximately @N{256 objects}.
@@ -3306,43 +3306,43 @@ For options that need extra arguments,
they are listed after the option.
@description{
@item{@id{LUA_GCCOLLECT}|
@item{@defid{LUA_GCCOLLECT}|
Performs a full garbage-collection cycle.
}
@item{@id{LUA_GCSTOP}|
@item{@defid{LUA_GCSTOP}|
Stops the garbage collector.
}
@item{@id{LUA_GCRESTART}|
@item{@defid{LUA_GCRESTART}|
Restarts the garbage collector.
}
@item{@id{LUA_GCCOUNT}|
@item{@defid{LUA_GCCOUNT}|
Returns the current amount of memory (in Kbytes) in use by Lua.
}
@item{@id{LUA_GCCOUNTB}|
@item{@defid{LUA_GCCOUNTB}|
Returns the remainder of dividing the current amount of bytes of
memory in use by Lua by 1024.
}
@item{@id{LUA_GCSTEP}|
@item{@defid{LUA_GCSTEP}|
Performs a step of garbage collection.
}
@item{@id{LUA_GCISRUNNING}|
@item{@defid{LUA_GCISRUNNING}|
Returns a boolean that tells whether the collector is running
(i.e., not stopped).
}
@item{@id{LUA_GCINC} (int pause, int stepmul, int stepsize)|
@item{@defid{LUA_GCINC} (int pause, int stepmul, int stepsize)|
Changes the collector to incremental mode
with the given parameters @see{incmode}.
Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}).
}
@item{@id{LUA_GCGEN} (int minormul, int minormajor, int majorminor)|
@item{@defid{LUA_GCGEN} (int minormul, int minormajor, int majorminor)|
Changes the collector to generational mode
with the given parameters @see{genmode}.
Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}).