-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Memory leak in quickpick #201320
Comments
Turns out all of these disposables were not getting cleaned up... but they really don't need to be disposables in this context. ref #201320
Turns out all of these disposables were not getting cleaned up... but they really don't need to be disposables in this context. ref #201320
Thanks for reporting this! I think I've cleaned up the |
Thanks a lot, @TylerLeonhardt! I see now:
{
"disposables": {
"before": [
{
"name": "Emitter",
"count": 2457,
"location": "/src/vs/base/common/event.ts:991:13"
},
{
"name": "LeakageMonitor",
"count": 2389,
"location": "/src/vs/base/common/event.ts:850:11"
},
{
"name": "DisposableStore",
"count": 2301,
"location": "/src/vs/base/common/lifecycle.ts:370:1"
},
{
"name": "DomListener",
"count": 911,
"location": "/src/vs/base/browser/dom.ts:131:13"
},
{
"name": "Action",
"count": 414,
"location": "/src/vs/base/common/actions.ts:68:13"
},
{
"name": "GlobalIdleValue",
"count": 186,
"location": "/src/vs/base/common/async.ts:1330:13"
},
{
"name": "MutableDisposable",
"count": 134,
"location": "/src/vs/base/common/lifecycle.ts:511:1"
},
{
"name": "DomEmitter",
"count": 110,
"location": "/src/vs/base/browser/event.ts:39:13"
},
{
"name": "LazyTokenizationSupport",
"count": 71,
"location": "/src/vs/editor/common/languages.ts:1970:30"
},
{
"name": "TokenizationSupportFactoryData",
"count": 71,
"location": "/src/vs/editor/common/tokenizationRegistry.ts:126:19"
},
{
"name": "RunOnceScheduler",
"count": 70,
"location": "/src/vs/base/common/async.ts:915:13"
},
{
"name": "DisposableMap",
"count": 64,
"location": "/src/vs/base/common/lifecycle.ts:718:1"
},
{
"name": "Delayer",
"count": 52,
"location": "/src/vs/base/common/async.ts:327:20"
},
{
"name": "Relay",
"count": 46,
"location": "/src/vs/base/common/event.ts:1589:0"
},
{
"name": "DecorationCSSRules",
"count": 41,
"location": "/src/vs/editor/browser/services/abstractCodeEditorService.ts:617:13"
},
{
"name": "ThrottledDelayer",
"count": 37,
"location": "/src/vs/base/common/async.ts:402:13"
},
{
"name": "Throttler",
"count": 37,
"location": "/src/vs/base/common/async.ts:178:1"
},
{
"name": "FocusTracker",
"count": 37,
"location": "/src/vs/base/browser/dom.ts:1256:13"
},
{
"name": "CancellationTokenSource",
"count": 34,
"location": "/src/vs/base/common/cancellation.ts:102:13"
},
{
"name": "MutableToken",
"count": 32,
"location": "/src/vs/base/common/cancellation.ts:60:0"
},
{
"name": "TimeoutTimer",
"count": 32,
"location": "/src/vs/base/common/async.ts:842:13"
},
{
"name": "DebounceEmitter",
"count": 28,
"location": "/src/vs/base/common/event.ts:1356:13"
},
{
"name": "MenuImpl",
"count": 26,
"location": "/src/vs/platform/actions/common/menuService.ts:335:2"
},
{
"name": "DragAndDropObserver",
"count": 26,
"location": "/src/vs/base/browser/dom.ts:2092:30"
},
{
"name": "EventMultiplexer",
"count": 25,
"location": "/src/vs/base/common/event.ts:1434:1"
},
{
"name": "ScrollbarVisibilityController",
"count": 21,
"location": "/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts:22:13"
},
{
"name": "ActionBar",
"count": 21,
"location": "/src/vs/base/browser/ui/actionbar/actionbar.ts:109:13"
},
{
"name": "GlobalPointerMoveMonitor",
"count": 21,
"location": "/src/vs/base/browser/globalPointerMoveMonitor.ts:17:0"
},
{
"name": "ActionRunner",
"count": 20,
"location": "/src/vs/base/common/actions.ts:168:0"
},
{
"name": "ViewContainerActivityAction",
"count": 19,
"location": "/src/vs/workbench/browser/parts/paneCompositeBar.ts:713:2"
},
{
"name": "ToggleCompositeBadgeAction",
"count": 19,
"location": "/src/vs/workbench/browser/parts/compositeBarActions.ts:764:10"
}
],
"after": [
{
"name": "Emitter",
"count": 2548,
"location": "/src/vs/base/common/event.ts:991:13"
},
{
"name": "LeakageMonitor",
"count": 2480,
"location": "/src/vs/base/common/event.ts:850:11"
},
{
"name": "DisposableStore",
"count": 2330,
"location": "/src/vs/base/common/lifecycle.ts:370:1"
},
{
"name": "DomListener",
"count": 911,
"location": "/src/vs/base/browser/dom.ts:131:13"
},
{
"name": "Action",
"count": 414,
"location": "/src/vs/base/common/actions.ts:68:13"
},
{
"name": "GlobalIdleValue",
"count": 186,
"location": "/src/vs/base/common/async.ts:1330:13"
},
{
"name": "MutableDisposable",
"count": 141,
"location": "/src/vs/base/common/lifecycle.ts:511:1"
},
{
"name": "DomEmitter",
"count": 110,
"location": "/src/vs/base/browser/event.ts:39:13"
},
{
"name": "LazyTokenizationSupport",
"count": 71,
"location": "/src/vs/editor/common/languages.ts:1970:30"
},
{
"name": "TokenizationSupportFactoryData",
"count": 71,
"location": "/src/vs/editor/common/tokenizationRegistry.ts:126:19"
},
{
"name": "RunOnceScheduler",
"count": 70,
"location": "/src/vs/base/common/async.ts:915:13"
},
{
"name": "DisposableMap",
"count": 64,
"location": "/src/vs/base/common/lifecycle.ts:718:1"
},
{
"name": "CancellationTokenSource",
"count": 55,
"location": "/src/vs/base/common/cancellation.ts:102:13"
},
{
"name": "MutableToken",
"count": 53,
"location": "/src/vs/base/common/cancellation.ts:60:0"
},
{
"name": "Delayer",
"count": 52,
"location": "/src/vs/base/common/async.ts:327:20"
},
{
"name": "Relay",
"count": 46,
"location": "/src/vs/base/common/event.ts:1589:0"
},
{
"name": "DecorationCSSRules",
"count": 41,
"location": "/src/vs/editor/browser/services/abstractCodeEditorService.ts:617:13"
},
{
"name": "ThrottledDelayer",
"count": 37,
"location": "/src/vs/base/common/async.ts:402:13"
},
{
"name": "Throttler",
"count": 37,
"location": "/src/vs/base/common/async.ts:178:1"
},
{
"name": "FocusTracker",
"count": 37,
"location": "/src/vs/base/browser/dom.ts:1256:13"
},
{
"name": "TimeoutTimer",
"count": 32,
"location": "/src/vs/base/common/async.ts:842:13"
},
{
"name": "DebounceEmitter",
"count": 28,
"location": "/src/vs/base/common/event.ts:1356:13"
},
{
"name": "MenuImpl",
"count": 26,
"location": "/src/vs/platform/actions/common/menuService.ts:335:2"
},
{
"name": "DragAndDropObserver",
"count": 26,
"location": "/src/vs/base/browser/dom.ts:2092:30"
},
{
"name": "EventMultiplexer",
"count": 25,
"location": "/src/vs/base/common/event.ts:1434:1"
},
{
"name": "ScrollbarVisibilityController",
"count": 21,
"location": "/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts:22:13"
},
{
"name": "ActionBar",
"count": 21,
"location": "/src/vs/base/browser/ui/actionbar/actionbar.ts:109:13"
},
{
"name": "GlobalPointerMoveMonitor",
"count": 21,
"location": "/src/vs/base/browser/globalPointerMoveMonitor.ts:17:0"
},
{
"name": "ActionRunner",
"count": 20,
"location": "/src/vs/base/common/actions.ts:168:0"
},
{
"name": "ViewContainerActivityAction",
"count": 19,
"location": "/src/vs/workbench/browser/parts/paneCompositeBar.ts:713:2"
},
{
"name": "ToggleCompositeBadgeAction",
"count": 19,
"location": "/src/vs/workbench/browser/parts/compositeBarActions.ts:764:10"
}
]
}
} I'll try to find more information for the MutableDisposables and DisposableStores where exactly they are created! Thanks again! Edit: The MutableDisposables are created in const picksDisposable = disposables.add(new MutableDisposable()); They are kept alive by a 200ms timeout and disposed after 200ms so it's no problem: (async () => {
if (typeof fastAndSlowPicks.mergeDelay === 'number') {
await timeout(fastAndSlowPicks.mergeDelay, picksToken);
if (picksToken.isCancellationRequested) {
return;
}
}
if (!slowPicksApplied) {
fastPicksApplied = applyPicks(fastAndSlowPicks.picks, true /* skip over empty to reduce flicker */);
}
})(), Just the test executing too fast / finishing before the MutableDisposables were disposed. :) |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
MutableDisposable
instance count has increased by 7,Action
instance count has increased by 211,DisposableStore
instance count has increased by 240 andEmitter
instance count has increased by 302. The total disposable count has increased by 1137 from 17322 to 18459.Test script
Additional Information
One class that has increased the most in the above test was
Action
. Looking whereActions
relates to the quick input I found this code in/quickInput.ts
where actions are created:Perhaps it could be this code that causes the
Actions
to be created. It seems the actions aren't registered/disposed like other disposables.The text was updated successfully, but these errors were encountered: