单个应用程序窗口的任务管理器中 Visual Studio 代码的多个实例或进程 [英] Multiple instances or processes of visual studio code in task manager for single application window

查看:69
本文介绍了单个应用程序窗口的任务管理器中 Visual Studio 代码的多个实例或进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Studio Code.我的机器遇到性能问题.我去了任务管理器,看到进程选项卡中有几个 Code.exe 实例,即使我的只有一个 Visual Studio Code 窗口正在运行/活动电脑.

我可以看到总共有八个 Code.exe 实例.尽管如此,我可以看到所有八个实例都占用了几 KB 到最大 55 MB 的 RAM 内存.所以有一件事可以肯定,这几个进程并没有占用太多内存,但它们的计数仍然让我绊了一跤.我了解到一个 Visual Studio Code 窗口应该映射到一个 Code.exe 进程.

我还有一个观察.我打开了另一个新的 Visual Studio Code 窗口,看到 Code.exe 进程的数量这次增加了两个而不是一个.当共有 2 个 Visual Studio Code 窗口当前处于活动状态时,总 Code.exe 进程计数现在单独变为 10.我不确定这里发生了什么.有人可以帮助我了解这是否是内部实现 Visual Studio Code 的正确行为?

解决方案

此行为是设计使然,并记录在 Github 问题的评论中

此外,快速浏览每个子 code.exe 进程的命令行参数将提供关于每个进程应该做什么的更多有用信息.例如子进程 code.exe 之一似乎是崩溃的错误报告进程.

"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 崩溃" --v=1

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.

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?

解决方案

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.

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

这篇关于单个应用程序窗口的任务管理器中 Visual Studio 代码的多个实例或进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆