Skip to content

Unbounded caches in Instance and Provider modules cause memory growth #13788

@sauerdaniel

Description

@sauerdaniel

Problem

Several places in the codebase use unbounded Map objects for caching:

  • Instance cache in project/instance.ts
  • Provider SDK cache in provider/provider.ts

In long-running processes or when handling many directories/providers, these maps can grow without limit, causing steady memory growth.

Expected behavior

Caches should have a maximum size with LRU eviction so memory remains bounded, with optional cleanup callbacks for evicted entries.

Related

This is distinct from #9143 (LSP diagnostics/files cleanup, already fixed in f936043). This issue is about the broader pattern of unbounded Map caches elsewhere in the codebase.

Metadata

Metadata

Assignees

Labels

perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions