Skip to content

fix(transcript): a past-the-end window resets to the char-budgeted tail; Electron heap report (#1475) - #1492

Merged
currentbits merged 2 commits into
mainfrom
coder/deep-dive-electron-renderer-heap-growth-24c5ea
Oct 6, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/deep-dive-electron-renderer-heap-growth-24c5ea

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part of #1475 (deep dive into PM3's Electron-only renderer heap growth). The full write-up is docs/perf/2026-10-06-electron-heap.md.

Finding: the unbounded growth is not a bridge or IPC leak. It is the stick-to-bottom pin loss that #1491 fixed: a trim's scrollTop clamp reads as the user scrolling up, so the window never trims again.

In a 30-stream Electron soak on main before #1491, the pin was lost at stream 10:

Stream 9 Stream 30
JS heap 44 MB 154 MB
DOM nodes 12k 175k
vmmap footprint ~150 MB 482 MB

With #1491, two 30-stream runs stayed pinned: heap 39–46 MB, DOM 12–13k and footprint 141–149 MB, flat from stream 6 to 30.

This PR's fix (clampWindowStart): when the store's retention cap drops a long thread's head, an unpinned window whose start was past the new length used to reset to the last 120 entries regardless of size. That mounted 48k nodes at once in the soak. It now resets to tailWindowStart, the character-budgeted tail.

Where PM3's +12 MB came from (all of it bounded):

  • the first thread:updated after launch is a full 4 MB transcript, released by stream 6;
  • the markdown parse cache reaching its 400k-char budget;
  • V8 code-space warm-up.

PM3's "RSS peak 416 MB" was ps RSS noise; the vmmap footprint is the reliable number.

Verified independently, on main merged with this branch

Safety: 18 Electron launches on the PM3 zero-leak recipe, each followed by a leak check, with no clone git writes and no recovered/*. The halts were attributed to live activity: an orchestrator worktree, the #1491 push, and a botpoc commit.

🤖 Generated with Claude Code

Willem and others added 2 commits October 6, 2026 14:13
…il (#1475)

The store's retention cap drops ~100 messages from the front of a long
thread, so a window start held while scrolled up (or unpinned) can land past
the shorter timeline. clampWindowStart then reset it to the last 120 entries
by count, skipping TRANSCRIPT_CHAR_BUDGET: in the Electron soak that mounted
~48k nodes of 45 KB answers in one push. Reset through tailWindowStart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urves (#1475)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T12:55:38.311688Z 9edff02 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits merged commit 21ecb71 into main Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant