From b6db7ce7f8dfe1a2f5e3f71328cb5c17e7d79641 Mon Sep 17 00:00:00 2001 From: Dirk Sohler Date: Tue, 12 Mar 2019 21:38:47 +0100 Subject: [PATCH] get rid of manual GC See https://gitlab.com/4w/mtimer/issues/7 --- init.lua | 3 --- settingtypes.txt | 10 ---------- system/register_globalstep.lua | 13 ------------- 3 files changed, 26 deletions(-) delete mode 100644 settingtypes.txt diff --git a/init.lua b/init.lua index 1662cf7..5cf906d 100644 --- a/init.lua +++ b/init.lua @@ -16,9 +16,6 @@ local S = minetest.get_translator('mtimer') mtimer = { translator = S, dialog = {}, - config = { - manual_gc = minetest.settings:get_bool('mtimer_manual_gc', false) - }, meta = { visible = { key = 'mtimer:visible', default = 'true' }, position = { key = 'mtimer:position', default = 'bl' }, diff --git a/settingtypes.txt b/settingtypes.txt deleted file mode 100644 index e8b98fa..0000000 --- a/settingtypes.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Manual Lua garbage collection -# -# This setting addresses a bug that reportedly happens -# on Windows. Lua seems to run out of memory. When this -# setting is enabled mTimer runs the Lua garbage -# collector automatically every 10 seconds. -# -# If you’re on Windows and your game does not crash -# simply ignore this setting. -mtimer_manual_gc (Perform manual Lua garbage collection) bool false diff --git a/system/register_globalstep.lua b/system/register_globalstep.lua index 349ffef..7270769 100644 --- a/system/register_globalstep.lua +++ b/system/register_globalstep.lua @@ -1,6 +1,5 @@ local m = mtimer local update_timer = m.update_timer -local manual_gc = m.config.manual_gc local connected_players = minetest.get_connected_players local timer = 0 @@ -18,15 +17,3 @@ minetest.register_globalstep(function(dtime) timer = 0 end) - - --- @see https://gitlab.com/4w/mtimer/issues/7 -if manual_gc == true then - local gc_timer = 0 - minetest.register_globalstep(function(dtime) - gc_timer = gc_timer + dtime; - if gc_timer < 10 then return end - collectgarbage() - gc_timer = 0 - end) -end