{{ message }}
Repository navigation
fix: memory leak in language model removal notifications - #340577
Merged
Dmitriy Vasyura (dmitrivMS) merged 9 commits intoOct 12, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 9 commits into
Dmitriy Vasyura (dmitrivMS) merged 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
In-flight model resolution can restore stale models after provider disposal.
1 open finding
What changed in this PR
Updates language-model provider disposal so consumers refresh after models are removed.
Changes:
- Emits a model-change event during provider disposal.
- Adds disposal notification and idempotency tests.
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
requested changes
Oct 9, 2026
Dmitriy Vasyura (dmitrivMS)
left a comment
Collaborator
There was a problem hiding this comment.
Please consider the comment
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
October 12, 2026 22:19
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 12, 2026
Paul (pwang347)
approved these changes
Oct 12, 2026
Bhavya U (bhavyaus)
approved these changes
Oct 12, 2026
Dmitriy Vasyura (dmitrivMS)
merged commit Oct 12, 2026
8854342
into
microsoft:main
75 of 77 checks passed
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-languageModelRemovalNotification
branch
October 13, 2026 09:40
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
Disposing a language model provider removes its models from LanguageModelsService without firing the model-change event. Consumers keep their previous model catalogs until another change occurs.
Change
Fire the vendor's model-change event after removing the provider, model groups and listener.
Before
When registering, discovering and disposing a 37-model provider over 37 cycles, CodexContinuationService keeps 37 model entries after disposal. The leaked objects are plain data records and do not appear in named-function-count3; the complete process-memory chart below provides context for the same scenario.
After
The 37 stale consumer entries are gone: exact model records stay at zero. Other heap growth remains; the process-memory totals below are context rather than an estimate of savings from these small objects.
Test Video
test-video.webm
AI disclosure: Model: GPT-6.1-Sol. Worktime: 16 min