[PR #7050] fix: add LRU eviction to LSP client file and diagnostics tracking #12224

Open
opened 2026-02-16 18:17:09 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7050

State: open
Merged: No


Fixes #3013

Summary

  • Add LRU eviction to LSP client file and diagnostics tracking maps
  • Create reusable LRUMap utility class with configurable max size

Problem

The LSP client tracks files and diagnostics in unbounded Maps. In large codebases or long sessions, these maps grow without limit, contributing to memory pressure.

Solution

Replace plain Map with LRUMap that automatically evicts least-recently-used entries when a maximum size is exceeded. Default limits:

  • Files: 1000 entries
  • Diagnostics: 500 entries

Testing

Added tests for LRUMap utility. LSP functionality preserved.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7050 **State:** open **Merged:** No --- Fixes #3013 ## Summary - Add LRU eviction to LSP client file and diagnostics tracking maps - Create reusable `LRUMap` utility class with configurable max size ## Problem The LSP client tracks files and diagnostics in unbounded Maps. In large codebases or long sessions, these maps grow without limit, contributing to memory pressure. ## Solution Replace plain `Map` with `LRUMap` that automatically evicts least-recently-used entries when a maximum size is exceeded. Default limits: - Files: 1000 entries - Diagnostics: 500 entries ## Testing Added tests for LRUMap utility. LSP functionality preserved.
yindo added the pull-request label 2026-02-16 18:17:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12224