diff --git a/exe/ruby-lsp b/exe/ruby-lsp index 4105cc6d1..bdbacd598 100755 --- a/exe/ruby-lsp +++ b/exe/ruby-lsp @@ -81,6 +81,8 @@ require "ruby_lsp/load_sorbet" $LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) require "ruby_lsp/internal" +T::Utils.run_all_sig_blocks + if options[:debug] if ["x64-mingw-ucrt", "x64-mingw32"].include?(RUBY_PLATFORM) $stderr.puts "Debugging is not supported on Windows" diff --git a/lib/ruby_lsp/server.rb b/lib/ruby_lsp/server.rb index 8ffb2b612..e38442b18 100644 --- a/lib/ruby_lsp/server.rb +++ b/lib/ruby_lsp/server.rb @@ -876,6 +876,11 @@ def perform_initial_indexing send_message(Notification.window_show_error("Error while indexing: #{error.message}")) end + # Indexing produces a high number of short lived object allocations. That might lead to some fragmentation and + # an unnecessarily expanded heap. Compacting ensures that the heap is as small as possible and that future + # allocations and garbage collections are faster + GC.compact + # Always end the progress notification even if indexing failed or else it never goes away and the user has no # way of dismissing it end_progress("indexing-progress")