You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several internal caches in OpenCode use standard Map objects without size limits. Over long-running sessions, these caches can grow without bound, contributing to memory issues like those reported in #5363.
Affected Caches
Instance cache (project/instance.ts) - Caches project instances by directory
Problem
Several internal caches in OpenCode use standard
Mapobjects without size limits. Over long-running sessions, these caches can grow without bound, contributing to memory issues like those reported in #5363.Affected Caches
project/instance.ts) - Caches project instances by directoryprovider/provider.ts) - Caches loaded SDK instanceslsp/index.ts) - Tracks LSP server spawn promisesCode Example
Impact
Relates to #5363
Expected Behavior
Caches should have bounded size with LRU eviction:
Proposed Solution
Create a bounded LRU (Least Recently Used) cache utility that:
maxEntriesonEvictcallback for cleanup when entries are removed