mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-26 23:36:48 +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:
commit
fff497c205
3 changed files with 19 additions and 0 deletions
|
@ -131,6 +131,10 @@ namespace MWLua
|
||||||
void LuaManager::update()
|
void LuaManager::update()
|
||||||
{
|
{
|
||||||
static const bool luaDebug = Settings::Manager::getBool("lua debug", "Lua");
|
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())
|
if (mPlayer.isEmpty())
|
||||||
return; // The game is not started yet.
|
return; // The game is not started yet.
|
||||||
|
|
||||||
|
|
|
@ -26,3 +26,15 @@ If one, a separate thread is used.
|
||||||
Values >1 are not yet supported.
|
Values >1 are not yet supported.
|
||||||
|
|
||||||
This setting can only be configured by editing the settings configuration file.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -1141,6 +1141,9 @@ lua debug = false
|
||||||
# If zero, Lua scripts are processed in the main thread.
|
# If zero, Lua scripts are processed in the main thread.
|
||||||
lua num threads = 1
|
lua num threads = 1
|
||||||
|
|
||||||
|
# Lua garbage collector steps per frame.
|
||||||
|
gc steps per frame = 100
|
||||||
|
|
||||||
[Stereo]
|
[Stereo]
|
||||||
# Enable/disable stereo view. This setting is ignored in VR.
|
# Enable/disable stereo view. This setting is ignored in VR.
|
||||||
stereo enabled = false
|
stereo enabled = false
|
||||||
|
|
Loading…
Reference in a new issue