diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-22 14:48:07 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-22 14:48:07 -0300 |
commit | e2cc179454c6aa6cde5f98954bd3783e0d5d53a3 (patch) | |
tree | 1770fb2eded15ad53211693b19eb2a8698cbf192 /manual | |
parent | ad0ea7813b39e76b377983138ca995189e22054f (diff) | |
download | lua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.tar.gz lua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.tar.bz2 lua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.zip |
New option "setparms" for 'collectgarbage'
The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 92 |
1 files changed, 61 insertions, 31 deletions
diff --git a/manual/manual.of b/manual/manual.of index e6a3cd9e..92d408e5 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -681,12 +681,10 @@ effectively producing a non-incremental, stop-the-world collector. | |||
681 | The garbage-collector step size controls the | 681 | The garbage-collector step size controls the |
682 | size of each incremental step, | 682 | size of each incremental step, |
683 | specifically how many objects the interpreter creates | 683 | specifically how many objects the interpreter creates |
684 | before performing a step. | 684 | before performing a step: |
685 | This parameter is logarithmic: | 685 | A value of @M{n} means the interpreter will create |
686 | A value of @M{n} means the interpreter will create @M{2@sp{n}} | 686 | approximately @M{n} objects between steps. |
687 | objects between steps. | 687 | The default value is 250. |
688 | The default value is 8, | ||
689 | which means steps of approximately @N{256 objects}. | ||
690 | 688 | ||
691 | } | 689 | } |
692 | 690 | ||
@@ -728,11 +726,13 @@ The default value is 100. | |||
728 | The major-minor multiplier controls the shift back to minor collections. | 726 | The major-minor multiplier controls the shift back to minor collections. |
729 | For a multiplier @M{x}, | 727 | For a multiplier @M{x}, |
730 | the collector will shift back to minor collections | 728 | the collector will shift back to minor collections |
731 | after a major collection collects at least @M{x%} of the allocated objects. | 729 | after a major collection collects at least @M{x%} |
730 | of the objects allocated during the last cycle. | ||
731 | |||
732 | In particular, for a multiplier of 0, | 732 | In particular, for a multiplier of 0, |
733 | the collector will immediately shift back to minor collections | 733 | the collector will immediately shift back to minor collections |
734 | after doing one cycle of major collections. | 734 | after doing one cycle of major collections. |
735 | The default value is 20. | 735 | The default value is 80. |
736 | 736 | ||
737 | } | 737 | } |
738 | 738 | ||
@@ -3336,19 +3336,32 @@ Returns a boolean that tells whether the collector is running | |||
3336 | (i.e., not stopped). | 3336 | (i.e., not stopped). |
3337 | } | 3337 | } |
3338 | 3338 | ||
3339 | @item{@defid{LUA_GCINC} (int pause, int stepmul, int stepsize)| | 3339 | @item{@defid{LUA_GCINC}| |
3340 | Changes the collector to incremental mode | 3340 | Changes the collector to incremental mode. |
3341 | with the given parameters @see{incmode}. | ||
3342 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). | 3341 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). |
3343 | } | 3342 | } |
3344 | 3343 | ||
3345 | @item{@defid{LUA_GCGEN} (int minormul, int minormajor, int majorminor)| | 3344 | @item{@defid{LUA_GCGEN}| |
3346 | Changes the collector to generational mode | 3345 | Changes the collector to generational mode. |
3347 | with the given parameters @see{genmode}. | ||
3348 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). | 3346 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). |
3349 | } | 3347 | } |
3350 | 3348 | ||
3349 | @item{@defid{LUA_GCSETPARAM} (int param, int value)| | ||
3350 | Changes the values of a parameter of the collector and returns | ||
3351 | the previous value of that parameter. | ||
3352 | The argument @id{param} must have one of the following values: | ||
3353 | @description{ | ||
3354 | @item{@defid{LUA_GCPMINORMUL}| The minor multiplier. } | ||
3355 | @item{@defid{LUA_GCPMAJORMINOR}| The major-minor multiplier. } | ||
3356 | @item{@defid{LUA_GCPMINORMAJOR}| The minor-major multiplier. } | ||
3357 | @item{@defid{LUA_GCPPAUSE}| The garbage-collector pause. } | ||
3358 | @item{@defid{LUA_GCPSTEPMUL}| The step multiplier. } | ||
3359 | @item{@defid{LUA_GCPSTEPSIZE}| The step size. } | ||
3360 | } | ||
3361 | } | ||
3362 | |||
3351 | } | 3363 | } |
3364 | |||
3352 | For more details about these options, | 3365 | For more details about these options, |
3353 | see @Lid{collectgarbage}. | 3366 | see @Lid{collectgarbage}. |
3354 | 3367 | ||
@@ -6347,20 +6360,35 @@ Returns a boolean that tells whether the collector is running | |||
6347 | } | 6360 | } |
6348 | 6361 | ||
6349 | @item{@St{incremental}| | 6362 | @item{@St{incremental}| |
6350 | Change the collector mode to incremental. | 6363 | Changes the collector mode to incremental and returns the previous mode. |
6351 | This option can be followed by three numbers: | ||
6352 | the garbage-collector pause, | ||
6353 | the step multiplier, | ||
6354 | and the step size @see{incmode}. | ||
6355 | A -1 or absent value means to not change that value. | ||
6356 | } | 6364 | } |
6357 | 6365 | ||
6358 | @item{@St{generational}| | 6366 | @item{@St{generational}| |
6359 | Change the collector mode to generational. | 6367 | Changes the collector mode to generational and returns the previous mode. |
6360 | This option can be followed by three numbers: | 6368 | } |
6361 | the garbage-collector minor multiplier, | 6369 | |
6362 | the minor-major multiplier, and the major-minor multiplier @see{genmode}. | 6370 | @item{@St{setparam}| |
6363 | A -1 or absent value means to not change that value. | 6371 | Changes the values of a parameter of the collector and returns |
6372 | the previous value of that parameter. | ||
6373 | This option must be followed by two extra arguments: | ||
6374 | The name of the parameter being changed (a string) | ||
6375 | and the new value for that parameter (an integer). | ||
6376 | The argument @id{param} must have one of the following values: | ||
6377 | @description{ | ||
6378 | @item{@St{minormul}| The minor multiplier. } | ||
6379 | @item{@St{majorminor}| The major-minor multiplier. } | ||
6380 | @item{@St{minormajor}| The minor-major multiplier. } | ||
6381 | @item{@St{pause}| The garbage-collector pause. } | ||
6382 | @item{@St{stepmul}| The step multiplier. } | ||
6383 | @item{@St{stepsize}| The step size. } | ||
6384 | } | ||
6385 | To be able to divide by 100 | ||
6386 | (as most parameters are given as percentages) | ||
6387 | without using floating-point arithmetic, | ||
6388 | Lua stores these parameters encoded. | ||
6389 | This encoding approximates the real value; | ||
6390 | so, the value returned as the previous value may not be | ||
6391 | equal to the last value set. | ||
6364 | } | 6392 | } |
6365 | 6393 | ||
6366 | } | 6394 | } |
@@ -9249,9 +9277,10 @@ declare a local variable with the same name in the loop body. | |||
9249 | @itemize{ | 9277 | @itemize{ |
9250 | 9278 | ||
9251 | @item{ | 9279 | @item{ |
9252 | There were several changes in the parameters | 9280 | Parameters for the garbage collection are not set |
9253 | for the options @St{incremental} and @St{generational} | 9281 | with the options @St{incremental} and @St{generational}; |
9254 | of the function @Lid{collectgarbage}. | 9282 | instead, there is a new option @St{setparam} to that end. |
9283 | Moreover, there were some changes in the parameters themselves. | ||
9255 | } | 9284 | } |
9256 | 9285 | ||
9257 | } | 9286 | } |
@@ -9277,9 +9306,10 @@ to signal the end of the dump. | |||
9277 | } | 9306 | } |
9278 | 9307 | ||
9279 | @item{ | 9308 | @item{ |
9280 | There were several changes in the parameters | 9309 | Parameters for the garbage collection are not set |
9281 | for the options @Lid{LUA_GCINC} and @Lid{LUA_GCGEN} | 9310 | with the options @Lid{LUA_GCINC} and @Lid{LUA_GCGEN}; |
9282 | of the function @Lid{lua_gc}. | 9311 | instead, there is a new option @Lid{LUA_GCSETPARAM} to that end. |
9312 | Moreover, there were some changes in the parameters themselves. | ||
9283 | } | 9313 | } |
9284 | 9314 | ||
9285 | } | 9315 | } |