Claude Code Memory Leak Fix for Linux Homelabs

✍️ OpenClawRadar📅 Published: March 21, 2026🔗 Source
Claude Code Memory Leak Fix for Linux Homelabs
Ad

Memory Leak Details

A developer running a Proxmox homelab with 64 cores and 503GB RAM experienced repeated crashes when using Claude Code to manage VMs, GitLab, DNS, and other services. Despite upgrading to 500GB RAM, Claude Code consumed 400GB and crashed the entire system.

Memory dump analysis revealed:

  • 1.15 billion identical 160-byte objects in heap
  • Objects never freed (free=0)
  • Growth rate of ~32,000 objects per second during active use
  • Idle usage is normal

Technical Findings

The investigation uncovered:

  • Claude Code is built on Bun runtime
  • Uses two allocators: mimalloc + glibc malloc
  • Leak is in glibc malloc side
  • JavaScript-level fixes don't work due to allocator layer
  • This has been an open issue for months with dozens of GitHub reports
Ad

Two-Tier Fix Solution

The developer created a Linux-only solution:

Tier 1 (10GB threshold): LD_PRELOAD shim that intercepts malloc(160) calls and caps growth. Zero overhead until threshold is reached.

Tier 2 (20GB threshold): Watchdog that restarts the session if Tier 1 isn't sufficient, acting as a safety net.

The fix is available at github.com/dalsoop/claude-code-memory-leak-fix.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

ToolLoop: Open-Source Agent Framework for Claude-Style Tools with Any Model
Tools

ToolLoop: Open-Source Agent Framework for Claude-Style Tools with Any Model

ToolLoop is an open-source Python framework with 11 tools for file operations, code search, shell access, and sub-agents that works with any LLM through LiteLLM. The 2,700-line framework allows switching models mid-conversation with shared context.

OpenClawRadar
DecisionNode: CLI and MCP Server for Semantic Decision Storage
Tools

DecisionNode: CLI and MCP Server for Semantic Decision Storage

DecisionNode is a local-only CLI and MCP server that stores structured decisions as JSON, embeds them as vectors for semantic search, and makes them accessible across AI tools via MCP. It's MIT licensed and designed to work with Claude Code, Cursor, Windsurf, Antigravity, and other MCP clients.

OpenClawRadar
TradesMCP: Open Source MCP Server for Contractor License Verification and Construction Data
Tools

TradesMCP: Open Source MCP Server for Contractor License Verification and Construction Data

TradesMCP is an open source Model Context Protocol server that provides Claude with access to real contractor license data, building permits, material pricing, and labor rates. The tool correctly verified an active California contractor license where ChatGPT returned incorrect information.

OpenClawRadar
E2a: Open-Source Email Gateway for AI Agents with SPF/DKIM Verification and Webhook/WebSocket Delivery
Tools

E2a: Open-Source Email Gateway for AI Agents with SPF/DKIM Verification and Webhook/WebSocket Delivery

E2a is an authenticated email gateway for AI agents that verifies SPF/DKIM on inbound mail, delivers via webhook or WebSocket, and supports outbound email with human-in-the-loop approval.

OpenClawRadar