summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-11-20 15:38:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-11-20 15:38:50 +0800
commita65a1ddb13854c2dfde4c04630a0a942abdafa32 (patch)
tree67d0121bf35f8c487119972b076fd8a6d41c04e6
parent50523d92c56de6eead73629b60916d9b9b892204 (diff)
downloadlua-language-server-a65a1ddb13854c2dfde4c04630a0a942abdafa32.zip
在空闲时执行垃圾回收
-rw-r--r--main.lua3
-rw-r--r--src/lsp.lua2
2 files changed, 5 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index 773fb0a8..893007d9 100644
--- a/main.lua
+++ b/main.lua
@@ -13,6 +13,9 @@ dbg:start()
require 'utility'
require 'global_protect'
+
+collectgarbage 'stop'
+
local service = require 'service'
local session = service()
diff --git a/src/lsp.lua b/src/lsp.lua
index cc35cf39..4a88aba6 100644
--- a/src/lsp.lua
+++ b/src/lsp.lua
@@ -79,6 +79,8 @@ function mt:_readAsContent(header)
if not response then
log.error(err or ('没有回应:' .. method))
end
+ -- 运行时不清理垃圾,在回复前端之后清理垃圾
+ collectgarbage()
end
function mt:setInput(input)