From d121050be94e7358e45fab3666404fd68d9c9c7b Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:00:33 +1000 Subject: [PATCH] incremental garbage collection to combat lag --- src/pc/lua/smlua.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index 4e2a50041..de29ebe7c 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -350,10 +350,12 @@ void smlua_update(void) { // incremental collection fails to keep up after some time. // So, for now, stop the GC from running during the hooks // and perform a full GC at the end of the frame. + // EDIT: That builds up lag over time, so we need to keep + // doing incremental garbage collection. // The real fix would be to make smlua produce less // garbage. - lua_gc(L, LUA_GCSTOP, 0); - lua_gc(L, LUA_GCCOLLECT, 0); + // lua_gc(L, LUA_GCSTOP, 0); + // lua_gc(L, LUA_GCCOLLECT, 0); } void smlua_shutdown(void) {