I wonder if someone setup a code to check the wall-clock time, and after xx minutes to force a LUA garbage cleanup, if some of the memory problems would go away.
Although from the format of the parameters, it seems like it might only be callable from C language.
There appears to be a LUA function for also calling "C style" functions, perhaps combine them if it truly is C function.
int lua_gc (lua_State *L, int what, ...);
Controls the garbage collector.
This function performs several tasks, according to the value of the parameter what. For options that need extra arguments, they are listed after the option.
- LUA_GCCOLLECT: Performs a full garbage-collection cycle.
- LUA_GCSTOP: Stops the garbage collector.
- LUA_GCRESTART: Restarts the garbage collector.
- LUA_GCCOUNT: Returns the current amount of memory (in Kbytes) in use by Lua.
- LUA_GCCOUNTB: Returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
- LUA_GCSTEP (int stepsize): Performs an incremental step of garbage collection, corresponding to the allocation of stepsize Kbytes.
- LUA_GCISRUNNING: Returns a boolean that tells whether the collector is running (i.e., not stopped).
- LUA_GCINC (int pause, int stepmul, stepsize): Changes the collector to incremental mode with the given parameters (see §2.5.1). Returns the previous mode (LUA_GCGEN or LUA_GCINC).
- LUA_GCGEN (int minormul, int majormul): Changes the collector to generational mode with the given parameters (see §2.5.2). Returns the previous mode (LUA_GCGEN or LUA_GCINC).