1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-05 04:11:35 +00:00

Run Lua GC in every frame

This commit is contained in:
Petr Mikheev 2022-12-03 16:56:23 +01:00
parent 9bbc4a54c1
commit 734f09abe6
3 changed files with 19 additions and 0 deletions

View file

@ -131,6 +131,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

@ -26,3 +26,15 @@ If one, a separate thread is used.
Values >1 are not yet supported.
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

@ -1141,6 +1141,9 @@ lua debug = false
# If zero, Lua scripts are processed in the main thread.
lua num threads = 1
# 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