[Bug]AutoBuild: macOS 大型工作区内存偏高——临时工作树扫描、URL 重复持有及侧栏全量查找
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- desktop, performance
Direzione di ricerca
Start with FileVisibilityRules.swift for the hidden-directory rules, then RustCoreBridge.swift where the snapshot builds both the tree nodes and the flat file list. The sidebar hot path runs from ProjectSidebarView.swift through AppModel.projectTreeURL to ProjectTreeLocator.matchingURL in AppModelSupportTypes.swift. Done means the reproduction workspace's URL object count and sidebar CPU drop in A/B measurements, with tree and search behaviour unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Platform / 平台
macOS
Area / 模块
Project and workspace / 项目与工作区
Lithe version / Lithe 版本
0.3.0,构建 20261015.154456,preview / AutoBuild。
安装包 commit:126e3cec6f996ee1399fdaf95738e55c1fadebde。
Priority / 优先级
P1 / 尽快处理:大型工作区有明显的额外内存和侧栏计算开销,但仍可继续使用;优先级可由维护者复核。
OS and architecture / 操作系统与架构
macOS 27.2(26B5112a),Apple Silicon / ARM64,24 GiB RAM。
Environment / 环境信息
2026-10-16 对已运行的安装版进行只读诊断。打开 Lithe-IDEA 仓库,项目侧栏可见,编辑器仅打开 bunfig.toml,内置 Codex 会话运行中。未运行 Java / LSP,未重启应用或修改设置。机器 swap 使用量为 0。
Steps to reproduce / 复现步骤
以下是实测现场的复现条件,尚未制作独立最小复现工程:
- 在工作区中保留多个
.claude/worktrees/<name>临时工作树,以及.artifacts构建、验证产物。 - 使用现有默认隐藏目录规则打开工作区,保持项目侧栏可见;这些目录不需要展开。
- 打开根目录文件,例如
bunfig.toml。现场还存在 Agent 会话更新。 - 对照 Lithe 状态栏与系统 physical footprint,并用
heap、sample检查对象分布和主线程热点。
Expected behavior / 预期行为
- 临时工作树、构建产物应有合适的排除策略,或采用不会为全部后代预先构造对象的树加载方式;保留用户显式查看这些目录的能力。
- 文件树和文件列表复用同一文件身份,避免各自创建完整 URL 对象。
- 侧栏刷新不应为判断一个按钮的可用性反复扫描整个工程并标准化全部路径。
- 内存指标应说明 RSS / physical footprint 的口径及统计范围,避免将未覆盖全部辅助进程的数值称为完整 Total。
Actual behavior / 实际行为
1. 大量临时目录进入完整工作区快照。
按当前内置目录排除规则统计,工作区约有 85,968 个文件、13,156 个子目录:
| 来源 | 文件数 |
|---|---|
.claude/worktrees |
56,785 |
.artifacts |
23,134 |
| 其他 | 6,049 |
前两项占约 93%。现有规则有 .worktree、.worktrees,但不匹配 .claude/worktrees 中不带点的 worktrees,也不包含 .artifacts。扫描器递归构造全部可见节点,不随侧栏目录折叠而延迟加载。
2. 文件树与扁平列表分别创建 URL,实测对象数量与此吻合。
堆快照约 175 MiB,其中 URLParseInfo 188,350 个 / 40.2 MiB,_SwiftURL 188,274 个 / 14.4 MiB,Swift.StringStorage 203,186 个 / 37.6 MiB。字符串是全进程统计,不能全部归因于路径。
快照转换分别执行 root.makeFileNode(...) 和 files.map { rootURL.appendingPathComponent($0) }。约 8.6 万文件 × 两份 URL,加上目录节点,与约 18.8 万 URL 对象高度吻合;减少扫描范围和 URL 重复持有后的实际收益仍需 A/B 测量。
3. 侧栏刷新反复执行全量路径查找。
两次独立调用栈采样均出现:
ProjectSidebarView.sidebarHeader
→ AppModel.canRevealInProjectTree
→ AppModel.projectTreeURL
→ ProjectTreeLocator.matchingURL(for:among:)
→ URL.standardizedFileURL / 路径字符串处理
第一次 3 秒采样中,主线程 194 个样本里有 131 个位于该查找调用下。进程快照 CPU 约 44%–58%。这是侧栏重复计算的证据,不应把该比例理解为内存分配占比;触发重绘的全部来源尚未定位。
4. 显示口径与真实内存负担存在差异。
诊断期间主进程 RSS 约 314–590 MiB,physical footprint 约 177–216 MiB。状态栏实现读取 resident_size,与活动监视器的 physical footprint 口径不同。
40 秒采样窗口内,主进程约 213 MiB;已确认归属 Lithe 的 WebKit 内容进程约 171–172 MiB,GPU 和网络进程另约 23–27 MiB;Codex 与两层 Node 约 129–131 MiB。所选进程合计约 536–541 MiB,未覆盖全部 MCP 辅助进程。现场状态栏显示 LSP / Services 为 0,未完整覆盖 WebKit 和当前 Agent 进程。
附带发现: leaks 报告 752 个泄漏块,共 613,248 bytes(约 0.6 MiB),包含 4 组 EditorTabDragPreviewStore 引用环及 CGRegion 报告。这不足以解释数百 MiB 的占用,可拆分跟踪。短时采样未见主进程持续攀升,不能据此排除长期使用后的泄漏。
Logs or diagnostic output / 日志或诊断输出
脱敏后的堆统计摘录:
All zones: 1101570 nodes (183630228 bytes)
COUNT BYTES CLASS_NAME
188350 42190400 URLParseInfo
203186 39447024 Swift.StringStorage
188274 15061920 _SwiftURL
leaks: 752 leaks for 613248 total leaked bytes
相关实现均链接到实测安装包的 commit:
建议修复顺序与验收
- 优先处理临时工作树、构建产物的扫描范围或按需加载策略,保留显式查看能力;确认项目树、搜索和文件监听的行为一致。
- 避免树和扁平列表各自创建完整 URL;以大文件数工作区对照对象数量及稳定后的 physical footprint。
- 将当前文件可定位性改为快照/活动文件变化时更新,或使用可复用的路径索引;侧栏刷新不再执行 O(N) 路径标准化。
- 明确内存显示口径和进程覆盖范围,避免 RSS 与 physical footprint 混用以及 Total 漏计。
- 对相同工程、相同打开文件及 Agent 状态做修改前后 A/B 采样,分别记录主进程、WebKit、Agent、LSP;不把进程峰值相加当作同时发生的总峰值。
- 对切换工作区、反复打开/关闭文件、编辑区卸载做有界生命周期验证,单独核实并处理拖动预览引用环。
本报告仅验证 macOS;涉及共享扫描策略时需同步检查 Windows,不能据此声称 Windows 已复现。调查未修改代码或设置,运行时 bundle 只读边界检查已通过。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,未发现相同的 macOS 报告;#1155 为 Windows 资源占用问题。
- I removed secrets and personal data from the report. / 报告仅包含脱敏统计和仓库相对路径,未上传原始内存转储、个人绝对路径或账号信息。
- Lingua principale
- TypeScript
- Stelle
- 1.8k
- Fork
- 151
- Merge medio
- 11h 45m
- PR unite (30g)
- 293
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di 1lck/Lithe-IDEA
-
area:editor bug P0 platform:macos review: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
1lck/Lithe-IDEA#1118 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
ci(macos): Mac mini runner 上 AgentBrandIconResourceTests 品牌图标渲染测试必然失败Forse già presa @1lck l’ha presa oggi. Apertareview: medium
1lck/Lithe-IDEA#1297 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 下拉git分支疯狂上下滚动直接崩了退出Forse già presa @arkleselect l’ha presa oggi. Apertaarea:editor bug issue-form:bug P0 platform:macos review: low
1lck/Lithe-IDEA#1277 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug][Windows/macOS] 从 origin/main 新建功能分支后,推送可能直接更新远端 mainForse già presa @milestone-17 l’ha presa oggi. Apertabug claimed review: medium
1lck/Lithe-IDEA#1272 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] 需要关闭已保存功能Forse già presa @haloneko l’ha presa 1 giorno fa. Apertaarea:ux claimed enhancement issue-form:feature P1 platform:windows review: medium
1lck/Lithe-IDEA#1260 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di 1lck/Lithe-IDEA
Issue simili
-
bug engine
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
frostney/GocciaScript#1746 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
agilepathway/label-checker#739 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
CopilotKit/OpenBot#800 ·
I maintainer di solito rispondono entro 1 giorno
-
Endpoint links in the tag operations list are below the 24px target sizeForse già presa @AdzerKI l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
I maintainer di solito rispondono entro 1 giorno