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.