Skip to content

Memory leak in ServiceHub.RoslynCodeAnalysisService.exe #81820

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


I often work on two solutions:

  • One that has 12 projects. It has a WinUI 3 app and a bunch of Class Library projects. It has about 1,200 files (.cs, .resw, etc.)
  • One that has 7 projects. It has two Blazor Server app projects, and five Class Library projects. It has about 500 files (.cs, .razor, .jpeg, etc.)

I have a consistent issue with the second solution (the one with Blazor Server apps): the memory of ServiceHub.RoslynCodeAnalysisService.exe increases over time, whether I edit .razor files or just C# files. On my 32 GB RAM device, this process can take easily 15-20GB of RAM within a few hours. When it happens, VS is barely usable:

  • Light-bulb and auto-completion list are very slow to show-up.
  • Rename (Ctrl+R, Ctrl+R) takes 10+ seconds just to show its UI, and much more to apply name change to the solution.
  • Cleaning usings across the whole solution using light bulb can take minutes to run.

After a few hours, I need to restart VS in order to free all the memory and get VS running fast again. It's quite annoying.

The fact that this issue doesn't happen with my other larger solution makes me suggest there's something wrong with Razor support, even when I don't have any .razor file opened or edited during my whole user session.

Please find in attachment a 16 GB memory dump of ServiceHub.RoslynCodeAnalysisService.exe for investigation.

PS: I noticed many feedback ticket are similar to mine, particularly this one: https://developercommunity.visualstudio.com/t/ServiceHubRoslynCodeAnalysisServiceexe/10986518 ; I tried telling in Dev Community that my feedback was similar and therefore just put the text above as a comment to this existing feedback, but the website crashed when I tried so.


Original Comments

Feedback Bot on 12/28/2025, 08:53 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

Feedback Bot solved on 12/30/2025, 10:20 AM, undefined votes:

Thanks for taking the time to report this issue! It seems to us that it’s describing the same thing as another one. We’ve closed this one as a duplicate and transferred all votes from this ticket to the other one. Please follow along on the linked ticket to communicate with the team, see updates on status, and help provide any needed diagnostic info. For more information, see our issue reporting guidelines.

Happy coding!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions