File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -508,11 +508,15 @@ local function askForDisable(uri)
508
508
end
509
509
end
510
510
511
- local function clearMemory ()
511
+ local function clearMemory (finished )
512
512
if m .scopeDiagCount > 0 then
513
513
return
514
514
end
515
515
vm .clearNodeCache ()
516
+ if finished then
517
+ collectgarbage ()
518
+ collectgarbage ()
519
+ end
516
520
end
517
521
518
522
--- @async
@@ -524,10 +528,11 @@ function m.awaitDiagnosticsScope(suri, callback)
524
528
while loading .count () > 0 do
525
529
await .sleep (1.0 )
526
530
end
531
+ local finished
527
532
m .scopeDiagCount = m .scopeDiagCount + 1
528
533
local scopeDiag <close> = util .defer (function ()
529
534
m .scopeDiagCount = m .scopeDiagCount - 1
530
- clearMemory ()
535
+ clearMemory (finished )
531
536
end )
532
537
local clock = os.clock ()
533
538
local bar <close> = progress .create (suri , lang .script .WORKSPACE_DIAGNOSTIC , 1 )
@@ -567,6 +572,7 @@ function m.awaitDiagnosticsScope(suri, callback)
567
572
end
568
573
bar :remove ()
569
574
log .info ((' Diagnostics scope [%s] finished, takes [%.3f] sec.' ):format (scp :getName (), os.clock () - clock ))
575
+ finished = true
570
576
end
571
577
572
578
function m .diagnosticsScope (uri , force )
Original file line number Diff line number Diff line change @@ -1159,6 +1159,7 @@ m.register '$/status/click' {
1159
1159
titleDiagnostic ,
1160
1160
DEVELOP and ' Restart Server' or nil ,
1161
1161
DEVELOP and ' Clear Node Cache' or nil ,
1162
+ DEVELOP and ' GC' or nil ,
1162
1163
})
1163
1164
if not result then
1164
1165
return
@@ -1177,6 +1178,9 @@ m.register '$/status/click' {
1177
1178
vm .clearNodeCache ()
1178
1179
collectgarbage ()
1179
1180
collectgarbage ()
1181
+ elseif result == ' GC' then
1182
+ collectgarbage ()
1183
+ collectgarbage ()
1180
1184
end
1181
1185
end
1182
1186
}
You can’t perform that action at this time.
0 commit comments