Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to investigate VS Code taking 30% of CPU although it is supposed to do nothing

My CPU is oscillating between 20 and 30% usage for CPU usage based on Windows Task manager. it is occurring for several hours now. I expect this VS Code instance to do nothing.

How can I investigate what is going wrong?

I tried to open "Developer: Toggle Developer Tools", then go to performance tab and record. Unfortunately it is reporting that most of the time is in "idle" (which is what I would expect)

(I also tried to ask on Twitter without success https://twitter.com/apupier/status/1100348567926071296)

regards,

like image 909
Aurélien Pupier Avatar asked Feb 26 '19 13:02

Aurélien Pupier


People also ask

Does VS Code use a lot of CPU?

The vscode Code Helper (Renderer) process consumes a lot of cpu and causes a very high processor temperature, closing vscode and disabling all extensions will not solve the problem. After a clean reinstall the problem persisted.

What causes high CPU usage in code?

The common reason for high CPU usage is loop in the code. It could be a loop in the user application or CICS code. Possible causes of a loop that does not terminate are: The termination condition can never occur.

Why my code is running slow in VS Code?

You might have extensions installed that slow Visual Studio down. For help on managing extensions to improve performance, see Change extension settings to improve performance. Similarly, you might have tool windows that slow Visual Studio down.


1 Answers

Based on the comments it seems that what the Task Manager reports is the total use of VS both on CPU utilization and memory.

A broad range of reasons could explain the observations you made.

1.Increased CPU and Memory usage by VS Studio.
 
 2. Increased Fan Speed.
 
 3. Your code being idle.

It can be the case that the VS Code or one of its plugins is actually doing something even if you do not actively use it. For sure if it is opened, even without being used the program will use some memory.

You can find more information on the CPU usage per VS Code Extension by typing: code --status in the command line. You can also try to execute: code --disable-extensions to run VS Code without any extensions to see if the CPU/Memory usage is reduced.

Results of the code --status will look like this

There are some related issues you could also see in GitHub, I checked before writing this answer:

  • 100% core CPU usage without apparent reason
  • Excess CPU usage
  • Excess CPU usage editing C file
like image 73
Spyros K Avatar answered Sep 29 '22 12:09

Spyros K