Skip to content

Stop idle renderer allocation from status animations - #542

Merged
nedtwigg merged 8 commits into
mainfrom
memory-leak
Sep 4, 2026
Merged

Stop idle renderer allocation from status animations#542
nedtwigg merged 8 commits into
mainfrom
memory-leak

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the command-mode selection ring's infinite marching animation with a four-cycle burst that restarts only on command entry or selection change
  • replace the persistent alert bell's infinite animation with a four-cycle burst and a static 45-degree resting pose
  • carry a per-Session latch sequence so an independent alert track can replay the bounded bell without same-track notification spam keeping it alive
  • preserve that sequence across the pre-registry/resume path while keeping it out of persisted Session state

Evidence

Measured in focused Chrome for Testing 150:

  • Marching ants: the infinite animation caused 60 style recalculations/second, added 3.77 MB of reclaimable embedder heap, and used 24.33 seconds of renderer CPU over five minutes. Pausing only that animation held embedder heap flat (-29 KB) and used 0.017 seconds over a three-minute control.
  • Alert bell: four infinite ringing bells added 6.89 MB of embedder memory, 1,127 style recalculations, and 3.99 seconds of renderer CPU over three minutes. Pausing only those animations reduced that to 0.13 MB, two recalculations, and 0.025 seconds.
  • After the bell fix: two consecutive three-minute windows had zero live animations, one style recalculation each, under 0.40 MB of non-cumulative embedder drift, and at most 0.024 seconds of renderer CPU.

In both cases JS heap, DOM node count, and listener count stayed flat. The growth was renderer-side work tied to a live CSS animation, matching the issue's wall-clock/no-terminal-output signature.

Tests

  • CI=true pnpm test
  • focused live Storybook/CDP before, paused-control, and after measurements

Fixes #483

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e9f39d
Status: ✅  Deploy successful!
Preview URL: https://612d686d.mouseterm.pages.dev
Branch Preview URL: https://memory-leak.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One non-blocking note: toPersistedAlertState in lib/src/lib/session-types.ts now duplicates toPersistedAlert in vscode-ext/src/session-state.ts, which hand-rolls the same status/todo/notification projection over the host's AlertState. Folding the latter into the new helper (alert ? toPersistedAlertState(alert) : fallback ?? null) would leave one place to edit the next time AlertState grows a never-persist field, and would also cover the one call in that file that skips the projection entirely — browserPersistedPane(pane, pane.alert ?? null) in refreshSavedSessionStateFromPtys, which writes a pre-this-PR watchingEnabled straight back out. Happy to push that as a commit if you want it here rather than as a follow-up.

@nedtwigg
nedtwigg merged commit da9904c into main Sep 4, 2026
13 checks passed
@nedtwigg
nedtwigg deleted the memory-leak branch September 4, 2026 05:38
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.

Webview renderer leaks ~25 MB/hour while idle

2 participants