From e2cc179454c6aa6cde5f98954bd3783e0d5d53a3 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 22 Dec 2023 14:48:07 -0300 Subject: 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. --- lua.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lua.h') diff --git a/lua.h b/lua.h index 32768561..5e2e08d9 100644 --- a/lua.h +++ b/lua.h @@ -325,7 +325,7 @@ LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont); /* -** garbage-collection function and options +** garbage-collection options */ #define LUA_GCSTOP 0 @@ -337,6 +337,25 @@ LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont); #define LUA_GCISRUNNING 6 #define LUA_GCGEN 7 #define LUA_GCINC 8 +#define LUA_GCSETPARAM 9 + + +/* +** garbage-collection parameters +*/ +/* parameters for generational mode */ +#define LUA_GCPMINORMUL 0 /* control minor collections */ +#define LUA_GCPMAJORMINOR 1 /* control shift major->minor */ +#define LUA_GCPMINORMAJOR 2 /* control shift minor->major */ + +/* parameters for incremental mode */ +#define LUA_GCPPAUSE 3 /* size of pause between successive GCs */ +#define LUA_GCPSTEPMUL 4 /* GC "speed" */ +#define LUA_GCPSTEPSIZE 5 /* GC granularity */ + +/* number of parameters */ +#define LUA_GCPN 6 + LUA_API int (lua_gc) (lua_State *L, int what, ...); -- cgit v1.2.3-55-g6feb