Skip to content

fix(memory): release transient reply animations - #1170

Open
kogekiplay wants to merge 1 commit into
spacering-net:mainfrom
kogekiplay:fix/release-transient-reply-animations
Open

kogekiplay wants to merge 1 commit into
spacering-net:mainfrom
kogekiplay:fix/release-transient-reply-animations

Conversation

@kogekiplay

Copy link
Copy Markdown
Contributor

Replies that change layout create transient Web Animations for glides and fades. On the affected WebKit build, a finished Animation can remain native pending activity. A glide's anonymous finish listener also captures its element, so that animation keeps a removed message-view tree reachable after the tab closes. Fade-ins previously had no terminal release at all.

Release these private, non-replayed animations on either finish or cancel: remove both terminal listeners, clear only the matching glide entry, then detach animation.timeline. Clearing only the matching entry preserves a replacement when an older cancellation event arrives late. This covers the custom reply glide/fade ownership boundary.

WebKit bug 329512 reports the native pending-activity behavior and timeline-detachment workaround. The local macOS 27.2.1 host uses the same tested WebKit build, 22625.2.8.11.9. That report corroborates the native root; this investigation did not capture a C++ heap graph.

A bounded native WKWebView fixture exercised the current full MessageList/runtime lifecycle with generated data: three replies, 96 lines each, 720 serial native deltas, 730 injected scripts / 726 distinct texts, animation on/off/on, then normal unmount and natural idle. The frozen baseline and candidate used identical workload and weak registration instrumentation; only the transient reply-animation lifecycle changed. Both were visible and unfocused, with no forced GC, allocation pressure, user database, live agent, debugger, or heap snapshot.

Final observation Baseline Terminal release
Retired runtime sessions alive / tracked 0 / 3 0 / 3
Retired completed replies alive / tracked 0 / 3 0 / 3
Retired view hosts alive / tracked 2 / 3 0 / 3
Live Animation finish-listener registrations 2 0
Pending callbacks / observed registrations 0 / 0 0 / 0
Final physical footprint 207.4 MiB 209.8 MiB

The two baseline callbacks resolve to glide → play → componentDidUpdate and capture the removed elements. A preceding full-view run without the ownership instrumentation also ended with two surviving hosts. Registration tracking held only weak targets/callbacks and recorded no capacity drops. Natural collection timing is uncontrolled; this is a scoped reachability/lifecycle result, not a retained-byte or long-term repair benchmark. Physical totals were similar.

Validation on current official main (bd88b9dac0417057342fca13234b9c19a8b8093d):

  • 20 focused reply-motion tests, including finish/cancel release, counterpart-listener removal, fade cleanup, and late cancellation preserving a replacement.
  • Complete frontend suite: 790 files / 11,717 tests passed on Node 24.22.3.
  • TypeScript, changed-file ESLint, Prettier, diff check, and production frontend build passed.
  • The native lifecycle comparison above completed normally with 119 physical samples per variant and no forced collection.

The original production WebContent long-term growth is still under investigation. This PR establishes and repairs the transient-animation host-retention path; it does not claim every cache, native allocation, tool/preview workload, or long-running session is covered. Real desktop integration and post-restart observation will be recorded separately.

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