Tweak Lua GC
authorRobin Gareus <robin@gareus.org>
Wed, 29 Nov 2017 11:03:18 +0000 (12:03 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 29 Nov 2017 11:06:42 +0000 (12:06 +0100)
libs/ardour/luaproc.cc
libs/ardour/session.cc
libs/lua/lua/luastate.h
libs/lua/luastate.cc

index 6617e8582f35831b64d3da6d9a07a69b1435f801..9122fb32fbdb9e5b1d71218dcd102a68a9201c8b 100644 (file)
@@ -744,7 +744,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
        int64_t t1 = g_get_monotonic_time ();
 #endif
 
-       lua.collect_garbage_step ();
+       lua.collect_garbage_step (100 /*kB*/);
 #ifdef WITH_LUAPROC_STATS
        ++_stats_cnt;
        int64_t t2 = g_get_monotonic_time ();
index dabd4bc187de9b4ad8889de9394287802b8bc94d..039288952bc0c6f3984fa2d1d4e583518128cdf4 100644 (file)
@@ -5486,7 +5486,7 @@ Session::try_run_lua (pframes_t nframes)
        Glib::Threads::Mutex::Lock tm (lua_lock, Glib::Threads::TRY_LOCK);
        if (tm.locked ()) {
                try { (*_lua_run)(nframes); } catch (...) { }
-               lua.collect_garbage_step ();
+               lua.collect_garbage_step (100 /*kB*/);
        }
 }
 
index cdc7f2b2bfeae818daf6862762f7a48a8bff08e3..1b55a1e706d095953b83578ab47b71b3f3e47721 100644 (file)
@@ -34,7 +34,7 @@ public:
        int do_command (std::string);
        int do_file (std::string);
        void collect_garbage ();
-       void collect_garbage_step ();
+       void collect_garbage_step (int debt = 0);
        void tweak_rt_gc ();
        void sandbox (bool rt_safe = false);
 
index 80ce41944c539c9b07728ed4c26645209d4354fa..f9dbbbaf29593048f1f42c30b8348486284504a7 100644 (file)
@@ -77,8 +77,8 @@ LuaState::collect_garbage () {
 }
 
 void
-LuaState::collect_garbage_step () {
-       lua_gc (L, LUA_GCSTEP, 0);
+LuaState::collect_garbage_step (int debt) {
+       lua_gc (L, LUA_GCSTEP, debt);
 }
 
 void