Multiple instances or processes of visual studio code in task manager for single application window

RBT picture RBT · Nov 26, 2016 · Viewed 8.1k times · Source

I'm using Visual Studio Code. I'm facing a performance issue on my machine. I went to task manager and saw that there are several instances of Code.exe in the process tab even though there is only one window of Visual Studio Code running/active on my PC.

Multiple Visual Studio Code exe instances in process tab

I can see that in all there are eight instances of Code.exe. Although, I can see that all eight instances are taking RAM memory in the range of few KBs to a maximum of 55 MB. So one thing was sure that these few processes are not eating up too much memory together but still their count stumbled me for a second. I had an understanding that one Visual Studio Code window should map to a single Code.exe process.

I've one more observation. I opened another fresh window of Visual Studio Code and saw that the count of Code.exe processes increased by two instead of one this time. Total Code.exe process count now became 10 on its own when a total of 2 Visual Studio Code windows are currently active. I'm not sure what's going on in here. Can someone help me understand if this is the right behavior on how Visual Studio Code is implemented internally?

Answer

Abhinav Galodha picture Abhinav Galodha · Mar 28, 2017

This behavior is by Design and is documented in the comments in the Github Issues #5856, #8006 and #20856

Summary from the comments mentioned in the Links

This behavior is a consequence of both how vscode was designed and the fact that it's build on Chromium/Electron. The number of processes should not really matter from an end user perspective, it's the amount of work each process does and the communication between them that are important.

By design, the UI framework we use is multi process by itself and then we have 1 process for extensions (per window), one process for file watching (per window) and 1 process for search. We also have 1 shared process for updates.

Using a Tool like Process Explorer, You can get more details about the Process. Only one of the Process code.exe would have the parent as explorer.exe which denotes the Main Process which spawned other Children Processes. Following is a screenshot of how the Main code.exe properties appears using the Tool Process Explorer.

enter image description here

Additionally, a quick glance at the command line arguments for each of the Children code.exe process would provide more useful information as to what each process is supposed to do. For e.g. one of the Child process code.exe seems to be an error Reporting Process for crashes.

"C:\Program Files (x86)\Microsoft VS Code\Code.exe" --reporter-url=https://ticinocrashreporter.azurewebsites.net/crash --application-name=VSCode "--crashes-directory=..\AppData\Local\Temp\VSCode Crashes" --v=1