Repository navigation
fix: memory leak in code actions - #330142
Merged
Dmitriy Vasyura (dmitrivMS) merged 10 commits intoAug 13, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 10 commits into
Dmitriy Vasyura (dmitrivMS) merged 10 commits into
Conversation
…ry-leak-quick-fix
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes code-action payload leaks by keeping the reusable disposable holder active and clearing stale action sets.
Changes:
- Clear retained code actions on retrigger and editor-model changes.
- Add regression coverage verifying disposal after clearing the model.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/vs/editor/contrib/codeAction/browser/codeActionModel.ts |
Corrects code-action disposal lifecycle. |
src/vs/editor/contrib/codeAction/test/browser/codeActionModel.test.ts |
Tests disposal of manually triggered actions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 13, 2026 08:12
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 13, 2026
Alex Ross (alexr00)
approved these changes
Aug 13, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Aug 13, 2026
Contributor
|
FYI - this PR might have introduced a bug where code actions that trigger commands with args are invoked more than a few seconds after opening the editor show an error: See #331834 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
CodeActionModel.trigger()permanently disposed its reusableMutableDisposablebefore the asynchronousCodeActionSetwas assigned. The later assignment became a no-op, so closing the editor never disposed the set and its extension-host command payloads remained cached.Change
Clear the holder when triggering new code actions so it remains reusable, and clear the current code-action set when the editor model changes.
Before
When applying a TypeScript quick fix and closing the editor 37 times,
VsCodeCodeAction, workspace edits, diagnostics, and closed-document functions each grow by 37, while related code-action objects grow faster:After
No matching code-action or closed-document leak is detected.
Test Video
editor-autofixes-available.after.webm