fix(memory): add TTL, LRU eviction, and ring buffers to prevent memory leaks#12259
fix(memory): add TTL, LRU eviction, and ring buffers to prevent memory leaks#12259Stranmor wants to merge 1 commit intoanomalyco:devfrom
Conversation
…y leaks - ACPSessionManager: add 1h TTL + 50 session limit with periodic cleanup - Instance cache: add 30min idle TTL + 10 instance LRU limit - LSP clients: add 20 client limit with oldest-first eviction - PTY buffers: replace string concatenation with RingBuffer class Addresses issues anomalyco#10913, anomalyco#9140, anomalyco#5363
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found 3 potentially related PRs that address similar memory leak issues:
These PRs likely overlap with the memory leak fixes in PR #12259. You should review PR #12053 in particular, as it appears to address the same core issue of resolving memory leaks in long-running sessions. |
Summary
Addresses memory leak issues reported in #10913, #9140, #5363.
This PR adds cleanup mechanisms to prevent unbounded memory growth in long-running sessions:
Changes
Technical Details
ACPSessionManager (
acp/session.ts)SessionEntrywrapper withlastAccesstimestampInstance cache (
project/instance.ts)CacheEntrywrapper withlastAccesstrackingevictIdleInstances()called on new instance creationLSP clients (
lsp/index.ts)MAX_LSP_CLIENTS = 20limitPTY buffers (
pty/index.ts)RingBufferclass with chunk-based storageTesting
Related Issues