{{ message }}
Repository navigation
fix: memory leak in timeline providers - #340881
Merged
Logan Ramos (lramos15) merged 2 commits intoOct 12, 2026
Merged
Logan Ramos (lramos15) merged 2 commits into
Logan Ramos (lramos15) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The cleanup correctly addresses the leak and is covered by focused lifecycle tests.
0 open findings
What changed in this PR
Fixes timeline-provider emitter leaks during unregistration and customer teardown.
Changes:
- Tracks provider emitters with
DisposableMap. - Disposes emitters during unregister and teardown.
- Adds lifecycle and regression tests.
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Logan Ramos (lramos15)
approved these changes
Oct 12, 2026
Nick Trogh (ntrogh)
approved these changes
Oct 12, 2026
Aiday Marlen Kyzy (aiday-mar)
approved these changes
Oct 12, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-mainThreadTimelineProviderDisposal
branch
October 13, 2026 09:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Details
Unregistering a timeline provider removes its service subscription, but leaves its change emitter in MainThreadTimeline's provider map. Customer teardown also needs to release these owned registrations.
Change
Dispose and delete the owned emitter on unregister, and use the same cleanup path for the customer's remaining provider IDs during disposal.
Before
When registering and unregistering timeline providers for 37 cycles, retired provider emitters rise from 0 to 37. The complete named-function chart reports a separate DomListener row and does not isolate the emitters.
After
Retired provider emitters stay at 0, while the live provider and services remain. The separate DomListener row is unchanged.
Test Video
test-video.webm
AI disclosure: Model: GPT-6.1-Sol. Worktime: 12 min