1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-19 21:40:45 +00:00

Run Lua GC in every frame

This commit is contained in:
Petr Mikheev 2022-12-03 16:56:23 +01:00
parent 55db95d4cf
commit 7c36a7eb49
3 changed files with 18 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View 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