Skip to content

Bad use of ResourcePool? #290328

@bpasero

Description

@bpasero

There are instances of ResourcePool where from the factory method, disposables are registered to the outer container (via this._register), not the thing itself:

this._pool = this._register(new ResourcePool(() => this.listFactory()));
}
private listFactory(): WorkbenchList<IChatCollapsibleListItem> {
const resourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this._onDidChangeVisibility }));

this._pool = this._register(new ResourcePool(() => this.treeFactory()));
}
private treeFactory(): WorkbenchCompressibleAsyncDataTree<IChatResponseProgressFileTreeData, IChatResponseProgressFileTreeData, void> {
const resourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this._onDidChangeVisibility }));

A good use seems to be:

class CollapsibleChangesSummaryListPool extends Disposable {

Metadata

Metadata

Assignees

Labels

freeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions