100% CPU usage - V8 StringTable performance collapse

Status Fixed / completed
Maintainer reply None cached
Activity 8 comments · opened Oct 26, 2025 · 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 ↗

8 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4580
  2. https://github.com/anthropics/claude-code/issues/1554
  3. https://github.com/anthropics/claude-code/issues/8968

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

kuzmeech · 11 months ago

Update: Process Terminated After Sample 4

Final stats before termination:

  • Runtime: 22+ minutes at 100% CPU
  • Memory growth: 3.2GB → 5.0GB (peak 4.1GB in sample4)
  • Process terminated (likely OOM or crash)
  • User sessions were corrupted/lost

Sample 4 added (999KB, mem: 4.1GB peak) - shows continued V8 StringTable bottleneck with no improvement.

Memory leak confirmed - process consumed 1.8GB additional memory over 22 minutes while stuck in string comparison loops.

kuzmeech · 11 months ago

Sample Files

All sample files and process info available in this gist:
https://gist.github.com/kuzmeech/7e649d3d57b4a0aac853f09e9a90c1fc

Files included:

  • sample1.txt (1.1MB) - Initial 5s sample, mem: 3.2GB
  • sample2.txt (138KB) - Follow-up 5s sample, mem: 3.2GB
  • sample3.txt (295KB) - 10s sample, mem: 3.5GB
  • sample4.txt (999KB) - Final 10s sample, mem: 4.1GB
  • process_info.txt (696B) - Process details
kuzmeech · 11 months ago

This is NOT a duplicate. While symptoms are similar (100% CPU, memory growth), the root causes are different:

#1554 (v1.0.10, Jun 3 2025, ~5mo old): Generic freeze, no root cause identified
#4580 (v1.0.61-1.0.62, Jul 25-28 2025, ~3mo old): JSON serialization recursion (2000+ JsonStringifier::Serialize_ calls)
#8968 (v2.0.8, Oct 4 2025, 21d old): StringPrototypeSplit heap exhaustion

#10349 (this issue, v2.0.27, Oct 24 2025, 1d old): V8 StringTable performance collapse

  • Root cause: StringTable::LookupString bottleneck (2541 samples in 10s)
  • Specific pattern: Megamorphic property access → String internalization → String::SlowEquals linear search
  • Progressive degradation documented across 4 samples (3.2GB → 5.0GB over 22 min)
  • ICU text segmentation involvement (icu_77::RuleBasedBreakIterator)

Evidence quality difference:

  • This issue: 4 progressive CPU samples with exact call stacks and memory metrics
  • Others: General descriptions or single-point failures

Version timeline: Different root causes manifesting across 5 months (Jun → Oct 2025), indicating multiple distinct performance bugs with similar symptoms. This issue reports the latest version with most detailed profiling data.

Actionable intel: This identifies a specific V8 string table hash collision scenario during dynamic object key creation with ICU text processing.

Not a duplicate - this is a distinct performance anti-pattern requiring targeted optimization.

waldoalvarez00 · 11 months ago

Becomes superslow for me after some time working. Not clear the cause but forces to restart the CLI. Showing in latest versions. 2.0.25 -> 27 (Windows 11 here)

chad-fossa · 11 months ago

Also happening for me on v2.0.46 2.4ghz 8core intel i9, 64gb 2667MHz DDR4, MacOS Sequoia 15.4

kuzmeech · 10 months ago

Closing - not reproducible in Claude Code 2.0.53. Will reopen if issue resurfaces.

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.