From 19e41856689d53aec64b1fff08c2df126eba7561 Mon Sep 17 00:00:00 2001 From: C6H12O6 + NaCl + H2O <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Mon, 25 Sep 2023 20:27:31 +0700 Subject: [PATCH] Fix Piano app (#991) * Trying to reduce memory leaks * Formalize the usage of pianoVK.ctrl and pianoVK.shift * Replace all loop, make a text object list * Add auto-garbage cleaner and remove 2 unnecessary variable * Update app_piano.lua --- parts/scenes/app_piano.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parts/scenes/app_piano.lua b/parts/scenes/app_piano.lua index 8e9e3d9d..3427583b 100644 --- a/parts/scenes/app_piano.lua +++ b/parts/scenes/app_piano.lua @@ -183,7 +183,13 @@ end function scene.update(dt) for _,key in pairs(pianoVK) do - key:update(dt) + key:update(nil,dt) + end + + if lastKeyTime and keyCount>626 and TIME()-lastKeyTime>10 then + collectgarbage() + lastKeyTime=nil + keyCount=0 end if lastKeyTime and keyCount>626 and TIME()-lastKeyTime>10 then