summaryrefslogtreecommitdiff
path: root/server/src/vm/chain.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-04 16:48:44 +0800
committersumneko <sumneko@hotmail.com>2019-04-04 16:48:44 +0800
commit88def129c6bbc7e1c2ae7e4fd670ed386f1e8e5e (patch)
tree733f4f9557eab8c7f55c113321f1cc961fa41edd /server/src/vm/chain.lua
parent38b43009f3325328630a4b9ee20d8cb9d8d9faf0 (diff)
downloadlua-language-server-88def129c6bbc7e1c2ae7e4fd670ed386f1e8e5e.zip
修正一些泄露,用了一些临时的办法中断编译链并清空缓存,以后重构
Diffstat (limited to 'server/src/vm/chain.lua')
-rw-r--r--server/src/vm/chain.lua11
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 = {},