Skip to content

[EPIC] Memory & CPU: full-app performance audit 2026-08 — fix tracking #987

Description

@h4yfans

Context

A production user (20 GB Mac) reported excessive RAM usage. The app is designed to stay open all day with every feature in use (inbox, journal, calendar, voice recorder, Agent Chat, graph, canvas, sync). A full static audit of the desktop app was performed on 2026-08-07 (main @ e4c9c90) across 8 subsystems: main-process lifecycle, sync/CRDT, database/indexer/projections, renderer hooks/services, heavy components (graph/editor/canvas/PDF), Agent Chat/MCP, media/voice/notifications, and the IPC boundary.

Every finding below is filed as its own issue, all carrying the audit-2026-08 label (plus memory-footprint). Severity is in each title: [MAJOR] = unbounded growth under normal daily use or a permanent CPU burn · [HIGH] = grows/leaks on a common action · [MEDIUM] = bounded but wasteful · [LOW] = minor/latent · [CLEANUP] = dead code carrying latent cost.

Rules for implementers (AI agents included)

Every child issue starts with the same instruction: first confirm the issue is still valid on current main (line numbers may have drifted; a later commit may have fixed it). Only implement after confirming. If invalid, comment evidence and close. Follow CLAUDE.md conventions, keep changes surgical, add tests, and use the memory snapshot harness (#446) for before/after evidence where applicable.

Most likely explanation of the 20 GB report

Y.Docs pinned forever by stale windowIds (compaction disabled as a side effect) · editors never destroyed + journal remounting an editor per external sync change · agent transcripts never evicted · orphaned Whisper utility processes (hundreds of MB each) · leaked PDF-export renderer processes · full note bodies retained in debugState · offline CRDT buffers.

Related pre-existing issues (folded into this epic)

Issue checklist (121 issues)

🔴 MAJOR — unbounded growth in daily use / permanent CPU burn (32)

Also MAJOR-equivalent, pre-existing: #449 (sync progress/conflict pruning — duplicates an audit finding)

🟠 HIGH — leaks/burns on a common action (37)

Also HIGH-equivalent, pre-existing: #448 (URL preview cache — duplicates an audit finding)

🟡 MEDIUM — bounded but wasteful (32)

⚪ LOW — minor / latent (17)

💀 CLEANUP — dead code carrying latent cost (3)

Follow-up findings (15) — surfaced while fixing the audit, filed separately

These are not original audit findings. Each was discovered by an implementer while fixing one of the issues above, and deliberately left unfixed so that PR would stay surgical. All 15 were verified against origin/main @ 2ba7f5950 on 2026-08-12 before filing, and all carry the audit-2026-08-followup label.

Several outrank the issue they were found next to — the first two are correctness, not memory.

🔴 MAJOR

🟠 HIGH

🟡 MEDIUM

⚪ LOW

Suggested fix order (highest impact/effort first)

  1. Stale windowIds pin Y.Docs (see MAJOR list) → 2. Graph rebuild + stuck physics loop → 3. Unguarded getAllWindows fan-outs → 4. Editor destroy verification (Evict idle BlockNote editors from renderer registry #447 related) → 5. debugState deletion → 6. Per-second snapshot push → 7. spawnSync per turn → 8. Agent transcript eviction + per-token rendering → 9. Telemetry sync writes → 10. Voice cancel/mic-hot fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit-2026-08Memory-leak & performance audit 2026-08 — one issue per finding, tracked under the epicmemory-footprintReduce desktop app memory footprint and main-process resident set

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions