Description
codebase-memory-mcp v0.8.1 has a severe memory leak when running as a persistent MCP server (stdio mode). Over the course of hours to ~2 days, the process grows to consume 50+ GB of virtual memory, eventually exceeding the system commit limit and crashing the entire Windows machine.
Environment
- OS: Windows 10, 64-bit (build 10.0.26100)
- codebase-memory-mcp version: v0.8.1 (installed via the official Windows .zip release, 269 MB binary)
- RAM: 32 GB physical
- Page file: system-managed
- Agent: Hermes Agent (launches codebase-memory-mcp as a subprocess via MCP stdio config)
- Single project indexed:
C:/Users/zhaid/.pi/agent (~55k nodes, ~113k edges, ~97 MB on disk)
- Config:
auto_index=false, auto_index_limit=50000
Evidence
Windows Resource-Exhaustion-Detector (Event ID 2004) logged twice before the crash:
00:23:54 — 8 minutes before crash:
| Process |
Virtual Memory (Commit Charge) |
codebase-memory-mcp.exe (PID 52508) |
46.4 GB |
python.exe (Hermes companion) |
59.4 GB |
00:28:53 — 3 minutes before crash — still growing:
| Process |
Virtual Memory |
codebase-memory-mcp.exe (PID 52508) |
54.5 GB (+8 GB in 5 min) |
python.exe (Hermes companion) |
59.3 GB |
Combined commit of ~114 GB exceeded the system commit limit (~100 GB = 32 GB RAM + page file), triggering:
Volsnap event 6: "The shadow copy of volume C: could not create a new page stack. The system may be low on virtual memory."
OmenCommandCenterBackground.exe crashed with System.OutOfMemoryException
Everything.exe crashed with stack overflow (0xc00000fd)
dwm.exe (Desktop Window Manager) crashed 3 times
AUDIODG.EXE (audio) crashed
- Eventually Kernel-Power 41: system rebooted uncleanly
Recurrence
This has happened at least 3 times since installation (June 12):
- Jun 13: same pattern — the process consumed ~107 GB
- Jun 15: ~99 GB
- Jun 23: ~114 GB (the crash described above)
Comparison vs normal state
Right now after a fresh restart:
codebase-memory-mcp.exe PID=22416 WS=12.3 MB
Working set is 12 MB. The commit charge grows to 50+ GB over time, which is clearly a memory leak in a long-running data structure.
Suspected cause
The knowledge graph data structure (nodes, edges, PageRank scores, etc.) is being retained in process memory without eviction as the index accumulates queries and incremental updates. The on-disk index is only ~97 MB, indicating the in-memory representation is leaking by multiple orders of magnitude.
Steps to reproduce
- Run
codebase-memory-mcp in stdio MCP server mode (as Hermes/Claude Code Agent would)
- Let it run for several hours to 2 days while the agent queries it
- Monitor virtual memory usage — it will climb steadily and never decrease
- Eventually the system runs out of commit charge and crashes
Note: auto_index=false does not prevent the leak — the growth happens on query/read operations, not just indexing.
Request
Please investigate the in-memory graph cache and query result retention. Consider:
- Adding an LRU eviction policy for cached query results
- Streaming graph data instead of keeping the full index in RAM
- A configurable max-memory limit that triggers compaction/eviction
Description
codebase-memory-mcpv0.8.1 has a severe memory leak when running as a persistent MCP server (stdio mode). Over the course of hours to ~2 days, the process grows to consume 50+ GB of virtual memory, eventually exceeding the system commit limit and crashing the entire Windows machine.Environment
C:/Users/zhaid/.pi/agent(~55k nodes, ~113k edges, ~97 MB on disk)auto_index=false,auto_index_limit=50000Evidence
Windows Resource-Exhaustion-Detector (Event ID 2004) logged twice before the crash:
00:23:54 — 8 minutes before crash:
codebase-memory-mcp.exe(PID 52508)python.exe(Hermes companion)00:28:53 — 3 minutes before crash — still growing:
codebase-memory-mcp.exe(PID 52508)python.exe(Hermes companion)Combined commit of ~114 GB exceeded the system commit limit (~100 GB = 32 GB RAM + page file), triggering:
Volsnapevent 6: "The shadow copy of volume C: could not create a new page stack. The system may be low on virtual memory."OmenCommandCenterBackground.execrashed withSystem.OutOfMemoryExceptionEverything.execrashed with stack overflow (0xc00000fd)dwm.exe(Desktop Window Manager) crashed 3 timesAUDIODG.EXE(audio) crashedRecurrence
This has happened at least 3 times since installation (June 12):
Comparison vs normal state
Right now after a fresh restart:
Working set is 12 MB. The commit charge grows to 50+ GB over time, which is clearly a memory leak in a long-running data structure.
Suspected cause
The knowledge graph data structure (nodes, edges, PageRank scores, etc.) is being retained in process memory without eviction as the index accumulates queries and incremental updates. The on-disk index is only ~97 MB, indicating the in-memory representation is leaking by multiple orders of magnitude.
Steps to reproduce
codebase-memory-mcpin stdio MCP server mode (as Hermes/Claude Code Agent would)Note:
auto_index=falsedoes not prevent the leak — the growth happens on query/read operations, not just indexing.Request
Please investigate the in-memory graph cache and query result retention. Consider: