fix: memory leak in chatServiceImpl - #327128
Merged
Dmitriy Vasyura (dmitrivMS) merged 6 commits intoJul 31, 2026
Merged
Conversation
Contributor
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
July 31, 2026 00:23
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 31, 2026
Dmitriy Vasyura (dmitrivMS)
left a comment
Contributor
There was a problem hiding this comment.
Simon Siefke (@SimonSiefke) build errors:
Error: [core-ci ] [00:24:41] src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts(663,16): error TS2345: Argument of type '(listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[] | undefined) => IDisposable' is not assignable to parameter of type 'Event'.
Dmitriy Vasyura (dmitrivMS)
requested changes
Jul 31, 2026
Don Jayamanne (DonJayamanne)
approved these changes
Jul 31, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 31, 2026
Dmitriy Vasyura (dmitrivMS)
merged commit Jul 31, 2026
c423d6b
into
microsoft:main
46 of 47 checks passed
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
Chat follow-up providers create cancellation token sources stored in
_sessionFollowupCancelTokens. Disposing a chat session model did not remove and dispose its token source.Change
The change removes and disposes the matching follow-up cancellation token source when the chat session model is disposed.
Before
When executing a terminal command from chat 37 times, follow-up cancellation token sources and mutable tokens grow across the runs (outlined in red):
After
No more matching cancellation token leak is detected.
Test Video
chat-terminal-command-7-runs.mp4