diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-13 10:36:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-13 10:36:41 +0800 |
commit | 1716e334b260396da460148560045bc55894c322 (patch) | |
tree | aa0a5856165c02ff594dbe496050e54f72b353ff /server/src/vm | |
parent | 52d631e2e5879c218adb0a969d337fc85732b593 (diff) | |
download | lua-language-server-1716e334b260396da460148560045bc55894c322.zip |
垃圾回收机制改回经典模式
Diffstat (limited to 'server/src/vm')
-rw-r--r-- | server/src/vm/source.lua | 9 | ||||
-rw-r--r-- | server/src/vm/value.lua | 3 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 17 |
3 files changed, 0 insertions, 29 deletions
diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua index 83f9569b..e6e15e9c 100644 --- a/server/src/vm/source.lua +++ b/server/src/vm/source.lua @@ -62,14 +62,6 @@ function mt:getUri() return self.uri end -function mt:setVM() - self.vm = vm -end - -function mt:isRemoved() - return self.vm:isRemoved() -end - function mt:set(name, v) if not self._flag then self._flag = {} @@ -92,7 +84,6 @@ return function (vm, source) if source._hasInstant then return false end - source.vm = vm setmetatable(source, mt) return true end diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index ee173c38..ece9e856 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -249,9 +249,6 @@ function mt:addInfo(tp, source, ...) if not source then return end - if source.uri ~= self.uri then - return - end Sort = Sort + 1 local info = { type = tp, diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index aeaffc13..4a54aeae 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -1166,22 +1166,6 @@ local function compile(ast, lsp, uri) return vm end --- TODO 测试代码 -local CachedVM = setmetatable({}, {__mode = 'kv'}) - -local function checkCachedVM(vm) - CachedVM[vm] = true - local total = 0 - local alive = 0 - for vm in pairs(CachedVM) do - total = total + 1 - if not vm:isRemoved() then - alive =alive + 1 - end - end - log.debug(('持有的VM:%d/%d'):format(alive, total)) -end - return function (ast, lsp, uri) if not ast then return nil @@ -1190,6 +1174,5 @@ return function (ast, lsp, uri) if not suc then return nil, res end - checkCachedVM(res) return res end |