OmniSharp using tons of memory while using Rider

  • Operating system: Windows 10
  • IDE name and flavor/env: Rider 2021.3.4
  • SonarLint plugin version:6.6.0.45106
  • Is connected mode used: no

We have a large solution containing around 95 projects. After I upgraded to the latest version of Rider with the latest version of SonarLint my memory consumption increased to 99%…
OmniSharp used 16GB of memory in that case.
After disabling SonarLint the problem did not occure again, but I would like to have SonarLint enabled for obvious reasons.

Hi @bramhoven

Thanks for reporting the issue. It is expected that OmniSharp consumes some memory, but 16Gb looks really bad.
We would like to know if this is purely an OmniSharp issue or if this is coming from the addition of our analyzer.

May I ask you to open your solution in VSCode with the VSCode C# extension, open a few files to ensure eveything is loaded, then check how much memory OmniSharp is using?

Thanks

Hi @Julien_HENRY,

I opened the same solution in VSCode. After waiting a while and opening different large files, this was the result.

Thanks

Thanks @bramhoven

We will investigate on our side, and come back to you when we know more.

1 Like

We have the same problem here, omnisharp with sonarlint using between 4 and 8 Gigs of RAM:

There’s also an OmniSharp issue open, without any real findings for now:

Is there anything we can do to assist? Maybe memory profiling OmniSharp.exe or similar?

Hi @MarkusSchaber

Do you know if there is a reason for you to have 3 Omnisharp processes? Do you open multiple solutions at the same time?
Do you see the same memory consumption issue when opening your project in VSCode?

By that time, I had 3 Rider instances open, each on a different solution, this explains the three OmniSharp processes.

I’m not using VSCode for C# programming, what do I need to do to correctly load a solution (.sln file) there?

Simply open VSCode with the C# plugin installed and open the folder that contains your solution and it should be enough. You can also manually select the .sln you want to load. Wait for language features to appear (intellisense, diagnostics) so ensure OmniSharp is done loading your solution, and then you can check for the memory consumption.

Hi,

I am getting the same issue. OmniSharp.exe leaks badly when using SonarLint + Rider (2022.1).

I tried profiling on OmniSharp.exe AFTER SonarLint analysis has completed (after seeing the SonarLint analyzing xxx status bar gone and issues report). Basically OmniSharp.exe keeps declaring more memory and never stops.

Here are some results from JetBrains dotMemory snapshots. The snapshots were taken when OmniSharp.exe was using 4GB and 5GB RAM and the analysis had already completed (or as it appeared to be in Rider). (the .csproj I tested only contains 5 .cs and 1 .asmdef files):

I can provide more details if that helps.

My current workaround is to manually task kill OmniShapr.exe after analysis has completed.

Thanks.