diff options
-rw-r--r-- | server/src/service.lua | 1 | ||||
-rw-r--r-- | server/src/vm/source.lua | 9 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 2 |
3 files changed, 11 insertions, 1 deletions
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 |