perf: v3.26.171 自动回收阈值放松(空闲 90s;RSS>2500MB 直接完整回收)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m57s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m57s
This commit is contained in:
1 parent
624cc4a34f
commit
b1b2438fa0
4 files changed
+11
-6
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.170",
|
||||
"version": "3.26.171",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.170"
|
||||
version = "3.26.171"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.170",
|
||||
"version": "3.26.171",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
@@ -237,10 +237,15 @@
|
||||
// v3.26.143:运行中不每 2 分钟清缓存(会触发图片重解码)。2026-12-01 折中:
|
||||
// 不可见立即回收;可见但连续 5 分钟没有任何输入时,也只做轻量回收(保留显示缩略图)。
|
||||
const idleMs = nowMs - lastUserAt
|
||||
const canVisibleIdleReclaim = !(typeof document !== 'undefined' && document.hidden) && idleMs > 300000
|
||||
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && ((typeof document === 'undefined' || document.hidden) || canVisibleIdleReclaim)) {
|
||||
// v3.26.171:自动回收阈值放松 —— 实测 3.4GB 时手动回收能立刻把 CPU 从 20% 降下来
|
||||
// (大堆导致持续 GC),而旧策略要求「可见且空闲 5 分钟」才动手,日常很难触发。
|
||||
// 现在:空闲 90s 即可轻量回收;RSS 超过 2500MB 时不等空闲,直接做完整回收(含缩略图缓存)。
|
||||
const canVisibleIdleReclaim = !(typeof document !== 'undefined' && document.hidden) && idleMs > 90000
|
||||
const heavyNow = procEst >= 2500
|
||||
const canReclaim = (typeof document === 'undefined' || document.hidden) || canVisibleIdleReclaim || heavyNow
|
||||
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && canReclaim) {
|
||||
memReclaimAt = nowMs
|
||||
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (canVisibleIdleReclaim ? 'idle ' : '') + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: true })).catch(() => { /* ignore */ })
|
||||
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (heavyNow ? 'heavy ' : (canVisibleIdleReclaim ? 'idle ' : '')) + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: !heavyNow })).catch(() => { /* ignore */ })
|
||||
}
|
||||
// 下面这条是「堆占比 ≥75%」的老护栏,只有 Chromium 系(Windows)才有意义
|
||||
if (!mem || !mem.ratio) return
|
||||
|
||||
Reference in new issue
Block a user