-
Notifications
You must be signed in to change notification settings - Fork 37k
fix: tiny memory leak in debugToolBar.ts #259349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
cc @deepak1556 |
connor4312
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
@microsoft-github-policy-service agree company="Anysphere" |
|
@connor4312 thanks for the review - i removed unused imports to address the hygiene concerns, so it looks like i need another approval. |
`dispose(IDisposable[])` call disposes every element of the array but does not clear the array itself - but it returns an empty array. As a result `debugViewTitleItems` array accumulates all items and keep references to them forever. There are two potential solutions: - `debugViewTitleItems = dispose(debugViewTitleItems)` - use DisposableStore This commit implements the second one.
9b10b67 to
402a4fd
Compare
| // Debug toolbar | ||
|
|
||
| const debugViewTitleItems: IDisposable[] = []; | ||
| const debugViewTitleItems = new DisposableStore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: this should be marked as singleton as well because it never gets disposed.
dispose(IDisposable[])call disposes every element of the array but does not clear the array itself - but it returns an empty array. As a resultdebugViewTitleItemsarray accumulates all items and keep references to them forever.There are two potential solutions:
debugViewTitleItems = dispose(debugViewTitleItems)This commit implements the second one.