diff options
-rw-r--r-- | manual/manual.of | 115 |
1 files changed, 62 insertions, 53 deletions
diff --git a/manual/manual.of b/manual/manual.of index 2c0957b9..fd49b404 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -575,7 +575,7 @@ or @Lid{collectgarbage} in Lua. | |||
575 | You can also use these functions to control | 575 | You can also use these functions to control |
576 | the collector directly (e.g., to stop and restart it). | 576 | the collector directly (e.g., to stop and restart it). |
577 | 577 | ||
578 | @sect3{@title{Incremental Garbage Collection} | 578 | @sect3{incmode| @title{Incremental Garbage Collection} |
579 | 579 | ||
580 | In incremental mode, | 580 | In incremental mode, |
581 | each GC cycle performs a mark-and-sweep collection in small steps | 581 | each GC cycle performs a mark-and-sweep collection in small steps |
@@ -624,7 +624,7 @@ which means steps of approximately @N{8 Kbytes}. | |||
624 | 624 | ||
625 | } | 625 | } |
626 | 626 | ||
627 | @sect3{@title{Generational Garbage Collection} | 627 | @sect3{genmode| @title{Generational Garbage Collection} |
628 | 628 | ||
629 | In generational mode, | 629 | In generational mode, |
630 | the collector does frequent @emph{minor} collections, | 630 | the collector does frequent @emph{minor} collections, |
@@ -633,17 +633,7 @@ If after a minor collection the use of memory is still above a limit, | |||
633 | the collector does a @emph{major} collection, | 633 | the collector does a @emph{major} collection, |
634 | which traverses all objects. | 634 | which traverses all objects. |
635 | The generational mode uses two parameters: | 635 | The generational mode uses two parameters: |
636 | the @def{major multiplier} and the @def{the minor multiplier}. | 636 | the @def{minor multiplier} and the @def{the major multiplier}. |
637 | |||
638 | The major multiplier controls the frequency of major collections. | ||
639 | For a major multiplier @M{x}, | ||
640 | a new major collection will be done when memory | ||
641 | grows @M{x%} larger than the memory in use after the previous major | ||
642 | collection. | ||
643 | For instance, for a multiplier of 100, | ||
644 | the collector will do a major collection when the use of memory | ||
645 | gets larger than twice the use after the previous collection. | ||
646 | The default value is 100; the maximum value is 1000. | ||
647 | 637 | ||
648 | The minor multiplier controls the frequency of minor collections. | 638 | The minor multiplier controls the frequency of minor collections. |
649 | For a minor multiplier @M{x}, | 639 | For a minor multiplier @M{x}, |
@@ -655,6 +645,16 @@ the collector will do a minor collection when the use of memory | |||
655 | gets 20% larger than the use after the previous major collection. | 645 | gets 20% larger than the use after the previous major collection. |
656 | The default value is 20; the maximum value is 200. | 646 | The default value is 20; the maximum value is 200. |
657 | 647 | ||
648 | The major multiplier controls the frequency of major collections. | ||
649 | For a major multiplier @M{x}, | ||
650 | a new major collection will be done when memory | ||
651 | grows @M{x%} larger than the memory in use after the previous major | ||
652 | collection. | ||
653 | For instance, for a multiplier of 100, | ||
654 | the collector will do a major collection when the use of memory | ||
655 | gets larger than twice the use after the previous collection. | ||
656 | The default value is 100; the maximum value is 1000. | ||
657 | |||
658 | } | 658 | } |
659 | 659 | ||
660 | @sect3{finalizers| @title{Garbage-Collection Metamethods} | 660 | @sect3{finalizers| @title{Garbage-Collection Metamethods} |
@@ -3022,55 +3022,58 @@ and therefore never returns | |||
3022 | 3022 | ||
3023 | } | 3023 | } |
3024 | 3024 | ||
3025 | @APIEntry{int lua_gc (lua_State *L, int what, int data);| | 3025 | @APIEntry{int lua_gc (lua_State *L, int what, ...);| |
3026 | @apii{0,0,-} | 3026 | @apii{0,0,-} |
3027 | 3027 | ||
3028 | Controls the garbage collector. | 3028 | Controls the garbage collector. |
3029 | 3029 | ||
3030 | This function performs several tasks, | 3030 | This function performs several tasks, |
3031 | according to the value of the parameter @id{what}: | 3031 | according to the value of the parameter @id{what}. |
3032 | For options that need extra arguments, | ||
3033 | they are listed after the option. | ||
3032 | @description{ | 3034 | @description{ |
3033 | 3035 | ||
3034 | @item{@id{LUA_GCSTOP}| | 3036 | @item{@id{LUA_GCCOLLECT}| |
3035 | stops the garbage collector. | 3037 | Performs a full garbage-collection cycle. |
3036 | } | 3038 | } |
3037 | 3039 | ||
3038 | @item{@id{LUA_GCRESTART}| | 3040 | @item{@id{LUA_GCSTOP}| |
3039 | restarts the garbage collector. | 3041 | Stops the garbage collector. |
3040 | } | 3042 | } |
3041 | 3043 | ||
3042 | @item{@id{LUA_GCCOLLECT}| | 3044 | @item{@id{LUA_GCRESTART}| |
3043 | performs a full garbage-collection cycle. | 3045 | Restarts the garbage collector. |
3044 | } | 3046 | } |
3045 | 3047 | ||
3046 | @item{@id{LUA_GCCOUNT}| | 3048 | @item{@id{LUA_GCCOUNT}| |
3047 | returns the current amount of memory (in Kbytes) in use by Lua. | 3049 | Returns the current amount of memory (in Kbytes) in use by Lua. |
3048 | } | 3050 | } |
3049 | 3051 | ||
3050 | @item{@id{LUA_GCCOUNTB}| | 3052 | @item{@id{LUA_GCCOUNTB}| |
3051 | returns the remainder of dividing the current amount of bytes of | 3053 | Returns the remainder of dividing the current amount of bytes of |
3052 | memory in use by Lua by 1024. | 3054 | memory in use by Lua by 1024. |
3053 | } | 3055 | } |
3054 | 3056 | ||
3055 | @item{@id{LUA_GCSTEP}| | 3057 | @item{@id{LUA_GCSTEP} @T{(int stepsize)}| |
3056 | performs an incremental step of garbage collection. | 3058 | Performs an incremental step of garbage collection, |
3059 | corresponding to the allocation of @id{stepsize} Kbytes. | ||
3057 | } | 3060 | } |
3058 | 3061 | ||
3059 | @item{@id{LUA_GCSETPAUSE}| | 3062 | @item{@id{LUA_GCISRUNNING}| |
3060 | sets @id{data} as the new value | 3063 | Returns a boolean that tells whether the collector is running |
3061 | for the @emph{pause} of the collector @see{GC} | 3064 | (i.e., not stopped). |
3062 | and returns the previous value of the pause. | ||
3063 | } | 3065 | } |
3064 | 3066 | ||
3065 | @item{@id{LUA_GCSETSTEPMUL}| | 3067 | @item{@id{LUA_GCINC} (int pause, int stepmul, stepsize)| |
3066 | sets @id{data} as the new value for the @emph{step multiplier} of | 3068 | Changes the collector to incremental mode |
3067 | the collector @see{GC} | 3069 | with the given parameters @see{incmode}. |
3068 | and returns the previous value of the step multiplier. | 3070 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). |
3069 | } | 3071 | } |
3070 | 3072 | ||
3071 | @item{@id{LUA_GCISRUNNING}| | 3073 | @item{@id{LUA_GCGEN} (int minormul, int majormul)| |
3072 | returns a boolean that tells whether the collector is running | 3074 | Changes the collector to generational mode |
3073 | (i.e., not stopped). | 3075 | with the given parameters @see{genmode}. |
3076 | Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}). | ||
3074 | } | 3077 | } |
3075 | 3078 | ||
3076 | } | 3079 | } |
@@ -5949,42 +5952,41 @@ It performs different functions according to its first argument, @id{opt}: | |||
5949 | @description{ | 5952 | @description{ |
5950 | 5953 | ||
5951 | @item{@St{collect}| | 5954 | @item{@St{collect}| |
5952 | performs a full garbage-collection cycle. | 5955 | Performs a full garbage-collection cycle. |
5953 | This is the default option. | 5956 | This is the default option. |
5954 | } | 5957 | } |
5955 | 5958 | ||
5956 | @item{@St{stop}| | 5959 | @item{@St{stop}| |
5957 | stops automatic execution of the garbage collector. | 5960 | Stops automatic execution of the garbage collector. |
5958 | The collector will run only when explicitly invoked, | 5961 | The collector will run only when explicitly invoked, |
5959 | until a call to restart it. | 5962 | until a call to restart it. |
5960 | } | 5963 | } |
5961 | 5964 | ||
5962 | @item{@St{restart}| | 5965 | @item{@St{restart}| |
5963 | restarts automatic execution of the garbage collector. | 5966 | Restarts automatic execution of the garbage collector. |
5964 | } | 5967 | } |
5965 | 5968 | ||
5966 | @item{@St{count}| | 5969 | @item{@St{count}| |
5967 | returns the total memory in use by Lua in Kbytes. | 5970 | Returns the total memory in use by Lua in Kbytes. |
5968 | The value has a fractional part, | 5971 | The value has a fractional part, |
5969 | so that it multiplied by 1024 | 5972 | so that it multiplied by 1024 |
5970 | gives the exact number of bytes in use by Lua. | 5973 | gives the exact number of bytes in use by Lua. |
5971 | } | 5974 | } |
5972 | 5975 | ||
5973 | @item{@St{step}| | 5976 | @item{@St{step}| |
5974 | performs a garbage-collection step. | 5977 | Performs a garbage-collection step. |
5975 | The step @Q{size} is controlled by @id{arg}. | 5978 | The step @Q{size} is controlled by @id{arg}. |
5976 | With a zero value, | 5979 | With a zero value, |
5977 | the collector will perform one basic (indivisible) step. | 5980 | the collector will perform one basic (indivisible) step. |
5978 | For non-zero values, | 5981 | For non-zero values, |
5979 | the collector will perform as if that amount of memory | 5982 | the collector will perform as if that amount of memory |
5980 | (in KBytes) had been allocated by Lua. | 5983 | (in Kbytes) had been allocated by Lua. |
5981 | Returns @true if the step finished a collection cycle. | 5984 | Returns @true if the step finished a collection cycle. |
5982 | } | 5985 | } |
5983 | 5986 | ||
5984 | @item{@St{setpause}| | 5987 | @item{@St{isrunning}| |
5985 | sets @id{arg} as the new value for the @emph{pause} of | 5988 | Returns a boolean that tells whether the collector is running |
5986 | the collector @see{GC}. | 5989 | (i.e., not stopped). |
5987 | Returns the previous value for @emph{pause}. | ||
5988 | } | 5990 | } |
5989 | 5991 | ||
5990 | @item{@St{incremental}| | 5992 | @item{@St{incremental}| |
@@ -5992,7 +5994,7 @@ Change the collector mode to incremental. | |||
5992 | This option can be followed by three numbers: | 5994 | This option can be followed by three numbers: |
5993 | the garbage-collector pause, | 5995 | the garbage-collector pause, |
5994 | the step multiplier, | 5996 | the step multiplier, |
5995 | and the step size. | 5997 | and the step size @see{incmode}. |
5996 | A zero means to not change that value. | 5998 | A zero means to not change that value. |
5997 | } | 5999 | } |
5998 | 6000 | ||
@@ -6000,15 +6002,10 @@ A zero means to not change that value. | |||
6000 | Change the collector mode to generational. | 6002 | Change the collector mode to generational. |
6001 | This option can be followed by two numbers: | 6003 | This option can be followed by two numbers: |
6002 | the garbage-collector minor multiplier | 6004 | the garbage-collector minor multiplier |
6003 | and the major multiplier. | 6005 | and the major multiplier @see{genmode}. |
6004 | A zero means to not change that value. | 6006 | A zero means to not change that value. |
6005 | } | 6007 | } |
6006 | 6008 | ||
6007 | @item{@St{isrunning}| | ||
6008 | returns a boolean that tells whether the collector is running | ||
6009 | (i.e., not stopped). | ||
6010 | } | ||
6011 | |||
6012 | } | 6009 | } |
6013 | See @See{GC} for more details about garbage collection | 6010 | See @See{GC} for more details about garbage collection |
6014 | and some of these options. | 6011 | and some of these options. |
@@ -8880,6 +8877,12 @@ do not accept surrogates as valid code points. | |||
8880 | An extra parameter in these functions makes them more permissive. | 8877 | An extra parameter in these functions makes them more permissive. |
8881 | } | 8878 | } |
8882 | 8879 | ||
8880 | @item{ | ||
8881 | The options @St{setpause} and @St{setstepmul} | ||
8882 | of the function @Lid{collectgarbage} are deprecated. | ||
8883 | You should use the new option @St{incremental} to set them. | ||
8884 | } | ||
8885 | |||
8883 | } | 8886 | } |
8884 | 8887 | ||
8885 | } | 8888 | } |
@@ -8925,6 +8928,12 @@ Errors in finalizers are never propagated; | |||
8925 | instead, they generate a warning. | 8928 | instead, they generate a warning. |
8926 | } | 8929 | } |
8927 | 8930 | ||
8931 | @item{ | ||
8932 | The options @idx{LUA_GCSETPAUSE} and @idx{LUA_GCSETSTEPMUL} | ||
8933 | of the function @Lid{lua_gc} are deprecated. | ||
8934 | You should use the new option @id{LUA_GCINC} to set them. | ||
8935 | } | ||
8936 | |||
8928 | } | 8937 | } |
8929 | 8938 | ||
8930 | } | 8939 | } |