process - 单个应用程序窗口的任务管理器中 Visual Studio 代码的多个实例或进程

标签 process visual-studio-code process-management

我正在使用 Visual Studio 代码。我的机器遇到性能问题。我去任务管理器看到有几个Code.exe的实例在进程选项卡中,即使我的 PC 上只有一个运行/事件的 Visual Studio Code 窗口。

Multiple Visual Studio Code exe instances in process tab

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

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

最佳答案

此行为是设计使然,并记录在 Github 问题 #5856 的评论中。 , #8006#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这表示产生其他子进程的主进程。以下是 Main code.exe 的截图使用工具 显示属性进程浏览器 .

enter image description here

此外,快速浏览每个子项的命令行参数 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

关于process - 单个应用程序窗口的任务管理器中 Visual Studio 代码的多个实例或进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40816178/

相关文章:

C# ProcessStartInfo

c# - Console.ReadLine() 在 VS Code 中不起作用,用 C# 编写代码

visual-studio-code - 测试自动完成到 VSCode 中的 TestWatcher

linux - Linux 如何管理和跟踪物理内存页面?

在 C 中更改当前进程的优先级

process - 如何将 std::process::Command 转换为命令行字符串?

Linux 网络命名空间 : process remains after killing container

linux - 需要澄清十二要素应用程序声明中的第八要素和守护进程

linux - 如何使用内核模块监控进程创建和统计

keyboard-shortcuts - 如何将编辑器窗口居中回到 VSCode 中的光标上?