Run Lua GC in every frame

7098-improve-post-process-behavior-with-transparent-objects
Petr Mikheev 2 years ago
parent 55db95d4cf
commit 7c36a7eb49

@ -132,6 +132,10 @@ namespace MWLua
void LuaManager::update()
{
static const bool luaDebug = Settings::Manager::getBool("lua debug", "Lua");
static const int gcStepCount = Settings::Manager::getInt("gc steps per frame", "Lua");
if (gcStepCount > 0)
lua_gc(mLua.sol(), LUA_GCSTEP, gcStepCount);
if (mPlayer.isEmpty())
return; // The game is not started yet.

@ -87,3 +87,14 @@ If exceeded (e.g. because of an infinite loop) the function will be terminated.
This setting can only be configured by editing the settings configuration file.
gc steps per frame
------------------
:Type: integer
:Range: >= 0
:Default: 100
Lua garbage collector steps per frame. The higher the value the more time Lua runtime can spend on freeing unused memory.
This setting can only be configured by editing the settings configuration file.

@ -1158,6 +1158,9 @@ log memory usage = false
# If exceeded (e.g. because of an infinite loop) the function will be terminated.
instruction limit per call = 100000000
# Lua garbage collector steps per frame.
gc steps per frame = 100
[Stereo]
# Enable/disable stereo view. This setting is ignored in VR.
stereo enabled = false

Loading…
Cancel
Save