Skip to content

Commit 1b8997b

Browse files
committed
Start compacting GC after finishing indexing
1 parent b2d6b21 commit 1b8997b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ruby_lsp/server.rb

+5
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,11 @@ def perform_initial_indexing
876876
send_message(Notification.window_show_error("Error while indexing: #{error.message}"))
877877
end
878878

879+
# Indexing produces a high number of short lived object allocations. That might lead to some fragmentation and
880+
# an unnecessarily expanded heap. Compacting ensures that the heap is as small as possible and that future
881+
# allocations and garbage collections are faster
882+
GC.compact
883+
879884
# Always end the progress notification even if indexing failed or else it never goes away and the user has no
880885
# way of dismissing it
881886
end_progress("indexing-progress")

0 commit comments

Comments
 (0)