fix: memory leak in abstract task service#289863
Merged
meganrogge merged 2 commits intomicrosoft:mainfrom Jan 23, 2026
Merged
Conversation
jrieken
approved these changes
Jan 23, 2026
meganrogge
added a commit
that referenced
this pull request
Jan 28, 2026
This reverts commit d50d600.
meganrogge
added a commit
that referenced
this pull request
Jan 28, 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 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.
Fixes a memory leak in
ProblemReporterandAbstractTaskService.Details
The
EmitterinProblemReportercurrently doesn't seem be registered as a Disposable:Therefore one change is registering the Emitter as a Disposable.
Another issue seems to be when calling
AbstractTaskService._computeWorkspaceFolderTasksmultiple times and usingthis._register:Since there is only one
AbstractTaskService, registering a disposable each time when calling_computeWorkspaceFolderTasksseems make the number of registered disposables grow each time.By changing it to a
DisposableMaptheDisposableMapensures that there is only one problemsReporter disposableStore per workspaceUri. And callingthis._workspaceTaskDisposables.set(workspaceFolder.uri, store)automatically disposes the previous registered disposableStore for that workspace uri.Before
When configuring a task 37 times, the number of various functions in
AbstractTaskService._computeWorkspaceFolderTasksand some other places seems to grow each time:After
When configuring a task 37 times, while the number of some functions still grows, for
AbstractTaskService._computeWorkspaceFolderTasksit stays constant now: