1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:53:52 +00:00

Merge branch 'lua_gc_48' into 'openmw-48'

[0.48] Run Lua GC in every frame

See merge request OpenMW/openmw!2531
This commit is contained in:
psi29a 2022-12-07 10:53:36 +00:00
commit fff497c205
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