diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-08 12:49:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-08 12:49:45 +0800 |
commit | 97b1ab219423555ca38b502d0545f302b3533afe (patch) | |
tree | 5162c3cb73239358c3668ebc4a07781c2d1419d5 | |
parent | 3c7ba4311186fcefbe2ff7af1c1b67690890d54e (diff) | |
download | lua-language-server-97b1ab219423555ca38b502d0545f302b3533afe.zip |
fix memory leak
-rw-r--r-- | script/vm/compiler.lua | 1 | ||||
-rw-r--r-- | script/vm/node.lua | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 43c7be1e..9c4807ea 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -930,6 +930,7 @@ local compilerSwitch = util.switch() : call(function (source) nodeMgr.setNode(source, m.compileNode(source.extends)) end) + : case 'doc' : case 'doc.param' : call(function (source) nodeMgr.setNode(source, m.compileNode(source.extends)) diff --git a/script/vm/node.lua b/script/vm/node.lua index b55c1ab5..d51c2318 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -1,4 +1,5 @@ local union = require 'vm.union' +local files = require 'files' ---@alias vm.node parser.object | vm.node.union | vm.node.global | vm.generic @@ -86,4 +87,10 @@ function m.clearNodeCache() m.nodeCache = {} end +files.watch(function (ev, uri) + if ev == 'version' then + m.clearNodeCache() + end +end) + return m |