From 42ec4d53d770a053c0909f14b5aa7c8cd42bbcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 13 Mar 2019 16:22:46 +0800 Subject: =?UTF-8?q?source=E5=A4=B1=E6=95=88=E6=97=B6=E8=A7=A3=E9=99=A4?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/service.lua | 1 + server/src/vm/source.lua | 9 +++++++++ server/src/vm/vm.lua | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/src/service.lua b/server/src/service.lua index 80b6bcb6..ba45f9f4 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -534,6 +534,7 @@ function mt:onTick() self:_doCompileTask() if os.clock() - self._clock >= 60 then + collectgarbage() self._clock = os.clock() local count = 0 for _ in pairs(self._file) do diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua index 247788b0..d53019c7 100644 --- a/server/src/vm/source.lua +++ b/server/src/vm/source.lua @@ -80,6 +80,15 @@ function mt:getName() return self[1] end +function mt:kill() + self._dead = true + self._bindLocal = nil + self._bindValue = nil + self._bindCall = nil + self._bindFunction = nil + self._bindCallArgs = nil +end + function mt:isDead() return self._dead end diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 00fce559..d9d29886 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -1150,7 +1150,7 @@ function mt:remove() end self._removed = true for _, source in ipairs(self.sources) do - source._dead = true + source:kill() end end -- cgit v1.2.3