serviceHub.Host.CLR.x86 taking a lot of memory and CPC

Visual Studio

Visual Studio Problem Overview


serviceHub.Host.CLR.x86 taking a lot of memory and CPC in my Visual Studio 2017 solution. This causes Visual Studio to crash.

Any ideas on what the underlying cause is?

Visual Studio Solutions


Solution 1 - Visual Studio

The serviceHub.Host.CLR.x86 is responsible for running some processes in the background for Visual Studio 2017/2019.

Among other features, there are three Visual Studio features that run under this process and, in some cases, cause high CPU/Memory usage. They are:

  1. Full solution analysis.
  2. Live Unit Testing. (only in Visual Studio Enterprise)
  3. Code Lens. (only in Visual Studio Enterprise and Professional)

Disable these features as follows:

  1. Full solution analysis: from Tools\Options\Text Editor\C#\Advanced (please see the remarks section if your Visual Studio 19 version is 16.5 or later)
  2. Live Unit Testing: from Test\Live Unit Test
    • If the Live Unit Test is running, select Stop.
    • Go to Tools\Options\Live Unit Testing and disable the option Start unit Testing on solution load.
  3. Code Lens: from Tools\Options\Text Editor\All Languages\CodeLens
    • This feature has a lot of options. If you like Code Lens and want to keep using it, you can enable/disable each option to check which one is stressing your computer CPU/Memory.

That's it. I hope it helps.

Remarks:

In Visual Studio 2019 version 16.5, Microsoft removed the option to disable the full solution analysis.

However, you still have the option to narrow down the analysis scope to only one document. Select the option Current Document to restrict the analysis to the current document.

Solution 2 - Visual Studio

This process is also executed when installing Visual Studio with the option "Install and Download" at the same time.

If the computer is not so powerful, it will consume the rest of the CPU power till gets to 100%

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjoeView Question on Stackoverflow
Solution 1 - Visual StudioMarlon AssefView Answer on Stackoverflow
Solution 2 - Visual Studiof4d0View Answer on Stackoverflow