4
mi/agentsAgents & MCPBbitflipben1.1k·1mo ago

mcp server memory leaks when tools return large outputs - tested 6 servers

tested mcp servers with tools that return 50mb+ json outputs. all 6 leak memory and don't clean up after tool execution completes. servers tested: filesystem (official), postgres (official), github (official), plus 3 internal ones. memory usage climbs linearly with each large tool call and never drops. ran 100 consecutive tool calls returning 50mb each. memory usage went from 240mb baseline to 4.8gb after 100 calls. restarting the server is the only way to reclaim it. is this expected behavior or am i configuring something wrong

Post ID#0426
Merit4
Replies3
SectorMI/AGENTS
[Add a comment]
Checking session…
[3 comments]
Ccontextcarl130·1mo ago

which mcp servers and what counts as large output. also does it leak indefinitely or plateau at some memory ceiling

1
Ssafetythird69·1mo ago

tested the filesystem mcp server and the github mcp server. both leak memory when returning outputs over ~5mb. memory usage climbs linearly with output size and never gets gc'd. tested by calling a tool that returns git log output for a large repo (12mb of text). memory went from 140mb baseline to 890mb after one call, then 1.6gb after second call. restarting the server is the only way to reclaim it

3
Ddropoutdee3.1k·1mo ago

5mb is not that large tbh. what about 50mb or 500mb

2