单个应用程序 window 的任务管理器中 visual studio 代码的多个实例或进程
Multiple instances or processes of visual studio code in task manager for single application window
我正在使用 Visual Studio 代码。我的机器遇到性能问题。我去了任务管理器,看到在进程选项卡中有几个 Code.exe
的实例,即使只有 一个 window 的 Visual Studio 代码running/active 在我的电脑上。
我可以看到总共有八个 Code.exe
实例。虽然,我可以看到所有八个实例都在占用几 KB 到最大 55 MB 范围内的 RAM 内存。所以有一点可以肯定,这几个进程并没有一起吃掉太多内存,但它们的数量仍然让我愣了一下。我理解一个 Visual Studio 代码 window 应该映射到单个 Code.exe
进程。
我还有一个观察结果。我打开了另一个新的 window of Visual Studio 代码,看到 Code.exe
进程的数量这次增加了两个而不是一个。当总共有 2 个 Visual Studio 代码 windows 当前处于活动状态时,总 Code.exe
进程计数现在自行变为 10。我不确定这里发生了什么。有人可以帮助我了解这是否是 Visual Studio 内部代码实施方式的正确行为?
好吧,我也刚刚在我的任务管理器中发现了这个问题。我的情况是 6 个实例。以前多了很多,但是一旦我在文件>打开最近中清除了最近的项目列表,这个数字就降到了6。
现在6的谜团也解开了。任务管理器中的额外实例用于 VS Code 中的 'Extensions'、'Code editor' 等 windows / 视图。
您可以通过在任务管理器中一个一个地杀死其他实例来验证这一点,当您这样做时,VS Code 将开始显示错误并抱怨我们在任务管理器中杀死的实例。
希望对您有所帮助。
此行为是设计使然,记录在 Github 问题 #5856, #8006 and #20856
的评论中
链接中提到的评论摘要
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.
使用 Process Explorer 之类的工具,您可以获得有关流程的更多详细信息。
只有一个进程 code.exe
的父进程为 explorer.exe
,表示产生其他子进程的主进程。以下是使用工具 Process Explorer.
显示 Main code.exe
属性的屏幕截图
此外,快速浏览每个子 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 Crashes" --v=1
我正在使用 Visual Studio 代码。我的机器遇到性能问题。我去了任务管理器,看到在进程选项卡中有几个 Code.exe
的实例,即使只有 一个 window 的 Visual Studio 代码running/active 在我的电脑上。
我可以看到总共有八个 Code.exe
实例。虽然,我可以看到所有八个实例都在占用几 KB 到最大 55 MB 范围内的 RAM 内存。所以有一点可以肯定,这几个进程并没有一起吃掉太多内存,但它们的数量仍然让我愣了一下。我理解一个 Visual Studio 代码 window 应该映射到单个 Code.exe
进程。
我还有一个观察结果。我打开了另一个新的 window of Visual Studio 代码,看到 Code.exe
进程的数量这次增加了两个而不是一个。当总共有 2 个 Visual Studio 代码 windows 当前处于活动状态时,总 Code.exe
进程计数现在自行变为 10。我不确定这里发生了什么。有人可以帮助我了解这是否是 Visual Studio 内部代码实施方式的正确行为?
好吧,我也刚刚在我的任务管理器中发现了这个问题。我的情况是 6 个实例。以前多了很多,但是一旦我在文件>打开最近中清除了最近的项目列表,这个数字就降到了6。
现在6的谜团也解开了。任务管理器中的额外实例用于 VS Code 中的 'Extensions'、'Code editor' 等 windows / 视图。
您可以通过在任务管理器中一个一个地杀死其他实例来验证这一点,当您这样做时,VS Code 将开始显示错误并抱怨我们在任务管理器中杀死的实例。
希望对您有所帮助。
此行为是设计使然,记录在 Github 问题 #5856, #8006 and #20856
的评论中链接中提到的评论摘要
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.
使用 Process Explorer 之类的工具,您可以获得有关流程的更多详细信息。
只有一个进程 code.exe
的父进程为 explorer.exe
,表示产生其他子进程的主进程。以下是使用工具 Process Explorer.
code.exe
属性的屏幕截图
此外,快速浏览每个子 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 Crashes" --v=1