VS Code uses 100% CPU even if it is closed

Viewed 3219

VS Code takes 100% CPU usage even it is not open. I ran the ps aux | grep PID command to check the details but can't understand anything. Here's the output:

tawhid           27099 100.0  0.1 447352160  11856   ??  R     7:18PM 151:14.95 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=fileWatcher
tawhid           31889   0.0  0.0 408628368   1616 s000  S+   10:28PM   0:00.00 grep 27099

Can anyone explain what process or extension uses so high CPU percentage? I have MacBook Air 2020. I have installed a lot of extensions out of curiosity.

1 Answers

Try to disabled "Settings Sync".

Like the latest versions of VSCode had an Electron process using too much CPU (40%-100%). Seems to be a bug related to electron

Here is this issue thread on github

enter image description here

Edited 7/1/2022: Another issue related to "Code Helper (Renderer)". Sometimes it's take a huge amount of CPU.

Go to settings –> followSymlinks and disable it. Or edit the settings.json and put:

search.followSymlinks: false

enter image description here

Another process that may use a lot of CPU is Google Chrome Helper (Renderer). This process is created when the VSCode javascript debugger is active. It's responsible to interact between the browser and the VSCode debugger. Here a link to help you diagnose it

Another relevant factor is audit performance. (Ctrl+Shift+P: windows or command+p: mac) then type: > and then type: performance.

Developer: Show Running Extensions: to get the basic stats about the running extensions and find out some possible issue. It sorts the extensions from longest to shortest activation time. The time is titled "Startup Activation" if the extension is loaded on startup.

Debug: Take Performance Profile: Then choose the process that you want to get the analyze report.

Debug: Startup Performance: Will show bunch of information on startup of vsCode.

In my case to get rid of all potentially problematic extensions I have removed vscode and all his extension/caches/etc and reinstalled, in mac this procedure can be done following this steps:

1st: remove vs from applications folder
rm -rf ~/Library/Preferences/com.microsoft.VSCode.helper.plist 
rm -rf ~/Library/Preferences/com.microsoft.VSCode.plist 
rm -rf ~/Library/Caches/com.microsoft.VSCode
rm -rf ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -rf ~/Library/Application\ Support/Code/
rm -rf ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -rf ~/.vscode*

Case all these steps have failed may you could try to downgrade VSCode to version 1.47 (in this version the current native debugger is not installed so all these involved processes aren't the same)

Related