100% CPU usage - V8 StringTable performance collapse

Resolved 💬 8 comments Opened Oct 26, 2025 by kuzmeech Closed Nov 25, 2025

process_info.txt
sample1.txt
sample2.txt
sample3.txt
sample4.txt

<img width="672" height="545" alt="Image" src="https://github.com/user-attachments/assets/0b1e8d6b-cff6-47e6-9bfa-390e376f8ee7" />

Claude Code 100% CPU Bug

Summary

Claude Code node process (PID 29085) consuming 98-100% CPU indefinitely due to V8 StringTable performance issue.

Environment

  • OS: macOS 26.0.1 (25A362)
  • Node: /opt/homebrew/Cellar/node/24.10.0/bin/node
  • Claude Code: 2.0.27
  • Parent Process: npm exec @anthropic-ai/claude-code@2.0.27
  • Working Directory: /Users/max/hobby/mac/bgc
  • Memory: 3.2GB → 3.5GB physical footprint (growing)
  • Uptime: 17+ minutes at 100% CPU

Root Cause Analysis

Sample 1 (Initial)

  • Heavy ICU (International Components for Unicode) garbage collection
  • icu_77::RuleBasedBreakIterator destructors
  • Memory deallocation in ICU library

Sample 2 (Follow-up) - Primary Issue

V8 String Table performance collapse:

Array.map →
  SetKeyedProperty →
    StringTable::LookupString →
      String::SlowEquals (996+ samples)
      CompareCharsEqual (328+ samples per call)

KeyedStoreIC_Megamorphic →
  StringTable::TryStringToIndexOrLookupExisting

ObjectPrototypeHasOwnProperty →
  StringTable lookups

JSON.stringify →
  JsonStringifier::SerializeString

Sample 3 (10-second, Confirmation)

Memory growth confirmed: 3.4GB → 3.5GB peak

V8 heap expansion detected:

  • PagedSpaceBase::TryExpand
  • MemoryAllocator::AllocatePage
  • mmap system calls for new pages

Same StringTable bottleneck (worse):

  • StringTable::LookupString - 2541 samples
  • String::SlowEquals - 1000+ samples
  • Hash table rehashing under load

Issue is stable and worsening over time.

Performance Anti-Pattern Detected

  1. Megamorphic property access - V8 IC (Inline Cache) deoptimization
  2. String table overload - thousands of unique string keys
  3. Linear string comparison - String::SlowEquals with byte-by-byte comparison
  4. Hash table rehashing - NameDictionary::Rehash during object property additions

Call Stack Pattern

RunMicrotasks →
  Promise chains →
    Array.map (on large dataset) →
      Object property assignments with dynamic keys →
        V8 string internalization →
          Linear search in string table →
            Byte-by-byte string comparison

Likely Trigger

Code is processing large arrays with:

  • Dynamic object key creation
  • Heavy use of hasOwnProperty
  • JSON stringification
  • ICU text segmentation (word/sentence breaking)

Impact

  • 100% CPU usage on single core
  • Process unresponsive
  • Memory gradually increasing to 3.2GB
  • System thermal throttling

Reproduction

Unknown - occurred during normal Claude Code operation in /Users/max/hobby/mac/bgc directory.

Files Attached

  • sample1.txt - Initial 5s sample showing ICU GC (1.1MB)
  • sample2.txt - Follow-up 5s sample showing V8 StringTable issue (138KB)
  • sample3.txt - Confirmation 10s sample showing memory growth (295KB)
  • process_info.txt - Process details
  • Screenshot showing Activity Monitor CPU usage (pending)

View original on GitHub ↗

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