Render loop causes 100% CPU when scrollback buffer grows large (55K+ rows)

Resolved 💬 3 comments Opened Jan 29, 2026 by debugmcpdev Closed Feb 2, 2026

Summary

Claude CLI becomes unresponsive at 100% CPU after extended session with large scrollback buffer. Root cause identified as yoga layout engine repeatedly re-rendering massive terminal buffer.

Environment

  • Claude Code version: 2.1.25
  • Platform: WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)
  • Runtime: Bun

Symptoms

  • Main thread stuck at 99-100% CPU (state 'R', not I/O blocked)
  • Memory: 5.7GB RSS, peaked at 135GB virtual
  • Session runtime: ~43 hours before becoming unresponsive

Root Cause

Debug log (~/.claude/debug/<session-id>.txt) shows scrollback grew to 55,019 rows:

2026-01-29T22:19:09.593Z [DEBUG] Slow render: 134.3ms, screen: 55019x116, damage: 116x55019 at (0,0), changes: 11
2026-01-29T22:19:16.137Z [DEBUG] High write ratio: blit=344670, write=5641848 (94.2% writes), screen=55019x116

The yoga layout engine repeatedly re-renders the entire 55K row buffer every ~130-150ms, consuming 100% CPU continuously.

Process Analysis

VmPeak:    135GB virtual (!)
VmRSS:     5.7GB physical
Threads:   34
  - Main thread: 100% CPU, state 'R' (running)
  - HeapHelper threads: sleeping (GC not active)

Reproduction

Extended session (~43 hours) working on CFD simulation debugging with:

  • 140+ file Read operations
  • Multiple Bash tool invocations with output
  • Large parameter files being read

Tool outputs accumulated in scrollback, eventually creating a 55K+ row buffer.

Suggested Fixes

  • Implement scrollback limit/truncation (e.g., cap at 10K rows)
  • Add render loop detection (skip re-rendering unchanged massive buffers)
  • Virtualize scrollback rendering (only render visible portion)
  • Truncate tool output display while keeping full data internal

Additional Data

Full diagnostics available in the report at: https://gist.github.com (can provide if helpful)

View original on GitHub ↗

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