fix: memory leak in line data event addon - #332139
Open
Simon Siefke (SimonSiefke) wants to merge 1 commit into
Open
fix: memory leak in line data event addon#332139Simon Siefke (SimonSiefke) wants to merge 1 commit into
Simon Siefke (SimonSiefke) wants to merge 1 commit into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
August 22, 2026 20:30
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents repeated loading of the terminal line-data addon, fixing callback retention across task reruns.
Changes:
- Tracks whether the addon has been loaded.
- Adds regression coverage for listener re-registration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
terminalInstance.ts |
Guards addon loading. |
terminalInstance.test.ts |
Tests repeated listener registration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| test('should only load the line data event addon once when listeners are re-added', async () => { | ||
| const instance = await createTerminalInstance(); | ||
| const lineDataEventAddon = instance['_lineDataEventAddon']!; | ||
| const originalActivate = lineDataEventAddon.activate.bind(lineDataEventAddon); |
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
|
data callback activation is detected |
|
Re-adding the first onLineData listener loaded the same LineDataEv |
|
terminal/test/browser/terminalInstance |
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
Re-adding the first
onLineDatalistener loaded the sameLineDataEventAddonagain, so each task rerun kept another pair of line-data callbacks reachable.Change
Track whether the per-terminal addon has already been loaded and skip subsequent loads when listeners are re-added.
Before
When rerunning the failing task 37 times, both line-data callbacks grow once per run:
After
No more repeated line-data callback activation is detected.
Test Video
test-video.webm