From 21e2f6e13dc3109469e82868c4fed78bb5fa7bbf Mon Sep 17 00:00:00 2001 From: weidu12123 Date: Fri, 16 Oct 2026 22:53:46 +0800 Subject: [PATCH] docs: state the desktop memory numbers without overselling them The table listed "never opened the window" next to "closed to tray" without saying what separates them, and the closing line claimed the tray state was where the app spends most of its time -- implying the 5 MB figure applies there. It does not. The distinction is whether the WebView was ever created, not whether the window is currently visible: hiding only drops it to WebView2's low memory level, so after the first time the window is opened, closing to tray leaves ~180 MB resident until the process restarts. Only an autostart instance that was never opened sits at 5 MB. Also note the cost of going further (destroying the WebView on hide): a reload on reopen, and the open tabs are lost today because the frontend does not persist its layout. Co-Authored-By: Claude Opus 4.8 --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 78c6a1e..d484d53 100644 --- a/README.md +++ b/README.md @@ -145,19 +145,23 @@ claude mcp add --transport http --scope user vps-switch http://<服务器IP>:188 | 状态 | 提交内存 | |---|---| -| 开机自启 / 启动即最小化,窗口从未打开 | **0 个 WebView2 进程**,后端 5 MB | -| 窗口打开 | WebView2 约 197 MB | -| 关闭到托盘 | WebView2 约 180 MB | +| 开机自启后**一次都没点开过窗口** | **0 个 WebView2 进程**,后端 5 MB | +| 窗口打开中 | WebView2 约 197 MB | +| 点 X 隐藏到托盘(WebView 已经创建过) | WebView2 约 180 MB | 窗口一旦创建就会拉起一整套 WebView2(Chromium),这是 WebView 壳的固定开销,不是后端占的。 -所以做了两件事把它压到最小: -- **启动即最小化时不创建 WebView**,点开才建——开机自启后躺在托盘里的常态因此只占几 MB; -- **关到托盘时把 WebView2 切到低内存档**(`ICoreWebView2_19::SetMemoryUsageTargetLevel`), - 实测再降 10–20%,且页面不重载,标签页与终端现场都保留。 +**关键区别是"WebView 有没有被创建过",而不是"窗口现在可不可见"**:这两行看起来都是"没有窗口", +但第一行是 WebView 从未创建(启动即最小化时不建,点开才建),第三行是创建过之后只被降到低内存档 +(`ICoreWebView2_19::SetMemoryUsageTargetLevel`)——降档实测省 10–20%,且页面不重载、标签页与 +终端现场都保留,代价是它不会归零。 + +所以要说实话:**只有"自启了但一直没点开"才是 5 MB。一旦打开过窗口,之后隐藏到托盘就是约 180 MB +一直挂着**,直到进程重启。想连这一份也省掉,就得在隐藏时销毁 WebView,代价是重开要重新加载页面、 +且当前会丢掉已打开的标签页(前端尚未做布局持久化)。 + +完全不要这个壳的部署方式是 Linux 无头,那条路是 10 MB。 -所以"它占多少内存"取决于窗口开着还是躺在托盘里——后者才是它绝大多数时间的状态。 -如果完全不要这个壳,Linux 无头部署那条路是 10 MB。 ---