fix(memory): hydrate 不再预读全部图片引用(v3.26.115)

114 二次启动验证:after-thumbs 111→10MB(缩略图复用成立),ready-2s 166→172MB 没降 ⇒ 启动固定峰。
根因是 wHydrateWorkspace 对每个引用都 wEnsureImgUrl,111 个各读 1.9MB 成 Uint8Array,GC 来不及收。
改为交给显示层按需解析,只读真正渲染到的节点。
This commit is contained in:
qiqi committed 2026-11-30 06:58:02 +08:00
1 parent dae9b8b4a9
commit 59e591fcb0
5 files changed
+17 -6

No files matched your search

+11
View File
@@ -16,6 +16,17 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.26.115(2026-11-30)启动峰值:hydrate 不再预读全部图片引用
114 二次启动验证:`after-thumbs` 111MB → **10MB**(缩略图落盘复用成立),但 `ready-2s` 166MB → **172MB** 没有下降
⇒ 这笔峰与缩略图无关,是启动期固定开销。
根因:`wHydrateWorkspace` 对每个引用都调 `wEnsureImgUrl`,111 个节点各自读 1.9MB 成 Uint8Array,
GC 来不及回收,2s 采样点稳定出现 ~170MB(当时屏幕只有 21 张图)。
- hydrate 改为**不预读**,交给显示层 `wResolveImg` 按需解析(只读真正渲染到的节点)
- 预期:`ready-2s` 峰值大幅下降,30s/60s 稳态仍是十几 MB
## v3.26.114(2026-11-29)宫格缩略图并发闸门:压掉 113 引入的 370MB 瞬时峰
113 实测稳态很好(60s heap 273MB → **16MB**,imgBigN 100 → 0,imgDataMB 260MB → 0.5MB),
+3 -3
View File
@@ -2664,9 +2664,9 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
for (const f of ['data', 'url']) {
const v = d[f]
if (wIsBlobRef(v) || wIsCacheRef(v)) {
// C3 第2步:引用**保留引用**,只解析显示用 objectURL(Cache Storage/IDB → Blob → URL)。
// 这就是「hydrate 不再产出 base64」的关键(原来这里会把整张图读回 JS 堆)。
wEnsureImgUrl(v)
// v3.26.115:不再预读全部引用(原来 111 个各读 1.9MB,GC 来不及收 ⇒ ready-2s 恒有 ~170MB 峰);
// 显示层 wResolveImg 会按需解析,只读真正渲染到的。
void v
} else if (v && v.__idb) {
// 历史 __idb 引用 → __blob(读一次即转存,不再把 base64 留在画布数据里)
d[f] = await wMigrateIdbRef(v)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.114",
"version": "3.26.115",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.114"
version = "3.26.115"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.114",
"version": "3.26.115",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",