Repository navigation
fix: memory leak extension actions - #315054
Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits intoMay 30, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses memory leaks caused by creating disposable extension-related actions (via instantiationService.createInstance(...)) and executing them without subsequently disposing them. This improves lifecycle hygiene in the Extensions UI/action flow within the workbench.
Changes:
- Dispose
InstallAnotherVersionActionafter running it (and after checking itsenabledstate) inInstallSpecificVersionOfExtensionAction. - Ensure various extension context menu actions created on-demand (theme toggles, install/update toggles, etc.) are disposed after
run()completes viatry/finally.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/extensions/browser/extensionsActions.ts | Disposes InstallAnotherVersionAction instances created transiently during “Install Specific Version…” flows (including enablement checks). |
| src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts | Disposes transient actions created in extension context menu command handlers by wrapping run() in try/finally. |
Dmitriy Vasyura (dmitrivMS)
approved these changes
May 30, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
May 30, 2026 23:38
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
TylerLeonhardt
approved these changes
May 30, 2026
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.
Fixes some memory leaks in extension actions.
Details
Actions can be disposable. In the case of extension actions, they are created and immediately being run. But a
disposecall seems to be missing.Change
The change is calling
disposeafter running the action:Maybe in the future this could be simplified with the new using keyword (assuming actions would have a
Symbol.disposeproperty:Before
When opening the extension view, and right clicking on an extension and selecting "Install Another Version", then closing the quickpick 17 times, the number of
InstallAnotherVersionActionand related functions seems to grow each time:After
No more leak is detected.