[BUG] Memory leak: 7.5GB ArrayBuffer accumulation in 3 minutes on Raspberry Pi 5

Resolved 💬 3 comments Opened Mar 14, 2026 by mrjesters Closed Mar 18, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

What's Wrong?

Claude Code accumulates ~7.5 GB of ArrayBuffer objects within ~3 minutes of a session, with a sustained growth rate of ~44
MB/s (153 GB/hour). On a Raspberry Pi 5 (8 GB RAM), this makes extended sessions impossible.

The V8 heap itself is only 54 MB — virtually all memory is in external / arrayBuffers, suggesting binary data from tool
calls (file reads of images, etc.) is not being dereferenced after consumption.

Diagnostics from /heapdump:

{
"uptimeSeconds": 176,
"memoryUsage": {
"heapUsed": 7954718527,
"heapTotal": 54683648,
"external": 7909366862,
"arrayBuffers": 7506240235,
"rss": 7892041728
},
"memoryGrowthRate": {
"bytesPerSecond": 44722301,
"mbPerHour": 153541
},
"v8HeapStats": {
"heapSizeLimit": 17006854144,
"mallocedMemory": 7954980926
},
"analysis": {
"potentialLeaks": [
"High memory growth rate: 153541.8 MB/hour"
]
}
}

Key observations:

  • arrayBuffers (7.5 GB) accounts for ~95% of total memory
  • V8 heap is only 54 MB — the leak is entirely in native/external memory
  • Growth rate of 44 MB/s means OOM within ~3 minutes on an 8 GB device
  • Workspace contains image files (.png, .jpg) and video files (.mp4) which were likely read during tool calls

What Should Happen?

ArrayBuffer data from file reads and tool results should be released after the tool result is consumed and rendered.
Memory should stabilise, not grow linearly.

Steps to Reproduce:

  1. Start a Claude Code session in a workspace containing binary files (images, videos)
  2. Have a conversation that involves reading/referencing files (including image files)
  3. Run /heapdump after a few minutes
  4. Observe arrayBuffers growing unboundedly

Is this a regression?

Unknown — first time profiling memory on this device.

Claude Code Version: 2.1.71
Platform: Anthropic (direct API)
Model: claude-opus-4-6
Operating System: Linux (Raspberry Pi OS, kernel 6.12.47+rpt-rpi-2712, aarch64)
Terminal/Shell: bash
Node Version: v24.3.0
Device: Raspberry Pi 5, 8 GB RAM

Additional context:

This is likely related to #32752 and #32546. The Pi 5 is a particularly acute case because 8 GB RAM means the OOM killer
hits fast, but the underlying ArrayBuffer retention bug affects all platforms. The gap between V8 heap (54 MB) and RSS
(7.5 GB) confirms this is native memory not under V8 GC control.

Heap snapshot available on request.

What Should Happen?

ArrayBuffer data from file reads and tool results should be released after the tool result is consumed. Memory should stabilise after initial load, not grow linearly at 44 MB/s.

Error Messages/Logs

{
    "memoryUsage": {
      "heapUsed": 7954718527,
      "heapTotal": 54683648,
      "external": 7909366862,
      "arrayBuffers": 7506240235,
      "rss": 7892041728
    },
    "memoryGrowthRate": {
      "bytesPerSecond": 44722301,
      "mbPerHour": 153541
    },
    "v8HeapStats": {
      "heapSizeLimit": 17006854144,
      "mallocedMemory": 7954980926
    },
    "analysis": {
      "potentialLeaks": ["High memory growth rate: 153541.8 MB/hour"]
    }
  }

Steps to Reproduce

  1. Start Claude Code in a workspace containing binary files (images, videos, PDFs)
  2. Have a conversation that reads or references image/video files via the Read tool
  3. Continue the conversation for a few minutes
  4. Run /heapdump
  5. Observe arrayBuffers in the diagnostics JSON growing unboundedly (7.5 GB in ~3 minutes)

Claude Model: claude-opus-4-6

Is this a regression? Select "I'm not sure"

Last Working Version: leave blank

Claude Code Version: 2.1.71

Platform: Select Anthropic

Operating System: Select Linux

Terminal/Shell: bash

Additional Information:

Device: Raspberry Pi 5, 8 GB RAM, aarch64
OS: Raspberry Pi OS, kernel 6.12.47+rpt-rpi-2712
Node: v24.3.0

The gap between V8 heap (54 MB) and RSS (7.5 GB) confirms this is native memory
not under V8 GC control. Likely related to #32752 and #32546.

On low-RAM devices like the Pi 5 this is critical — OOM killer hits within minutes.
But the underlying ArrayBuffer retention affects all platforms.

Heap snapshot file available on request.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.76 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗