diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-04 16:48:44 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-04 16:48:44 +0800 |
commit | 88def129c6bbc7e1c2ae7e4fd670ed386f1e8e5e (patch) | |
tree | 733f4f9557eab8c7f55c113321f1cc961fa41edd /server/src/vm/chain.lua | |
parent | 38b43009f3325328630a4b9ee20d8cb9d8d9faf0 (diff) | |
download | lua-language-server-88def129c6bbc7e1c2ae7e4fd670ed386f1e8e5e.zip |
修正一些泄露,用了一些临时的办法中断编译链并清空缓存,以后重构
Diffstat (limited to 'server/src/vm/chain.lua')
-rw-r--r-- | server/src/vm/chain.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/vm/chain.lua b/server/src/vm/chain.lua index 23b38a75..55947105 100644 --- a/server/src/vm/chain.lua +++ b/server/src/vm/chain.lua @@ -21,6 +21,7 @@ function mt:clearCache() if ok then n = n + 1 else + value:getSource():kill() self.cache[uri] = nil end end @@ -42,6 +43,16 @@ function mt:get(uri) return self.cache[uri] end +function mt:remove() + if self.removed then + return + end + self.removed = true + for _, value in pairs(self.cache) do + value:getSource():kill() + end +end + return function () return setmetatable({ cache = {}, |