Qwen Code hits heap OOM on glob in repos with huge untracked folders
XxCotHGxX · ghdev · 2026-09-18
Issue #12151 in QwenLM/qwen-code reports that in a repo with only 3.8k tracked files but 532k untracked experiment-output files, running a glob like /something/metrics.py crashes the session within minutes with JavaScript heap out of memory.
The memory isn't going to the walk itself. Since #6123, glob checks ignore rules for every directory it enters; GitIgnoreParser.isIgnored() goes through getIgnorerForDir(), which builds a new ignore() instance per directory, re-adding .git, .git/info/exclude and every .gitignore rule from the root down, and keeps it in an ignorerCache that is never trimmed. FileDiscoveryService lives for the whole session, so every directory the walk touches holds its own compiled copy of the rules (plus that instance's internal per-path result cache). With a 45-rule root .gitignore that's roughly 8 KB per directory, so the walk hits the default 4 GB heap long before finishing.
Numbers from running GlobTool + FileDiscoveryService directly (no model) with --max-old-space-size=4096, live heap after forced GC:
- 0.23.3 as shipped: 646 MB at 11s, 1429 MB at 27s, 2723 MB at 56s, OOM at 97s
- no ignore rules at all: peaks at 1558 MB mid-walk (1.09M entries, since .venv etc. aren't skipped), drops to 64 MB at 31s
- with the proposed change: peaks at 727 MB mid-walk, finishes in 52s
More from coding & agent
- One Box, One Gateway: A Food Company Runs Its Business on Hermes — Teknium · 2026-09-18
- Why AI transformation fails: companies won't change decision-making — JoeJustice · 2026-09-18
- Anthropic says 80% of Claude's own code is now written by Claude — chrismattmann · 2026-09-18
- One Call, Three Consistency Boundaries: dissecting mem0's memory layer architecture — Mahmoud_Zalt · 2026-09-18
- The Model Fills the Blank: Designing Gates That Take Verdict Authority Away From AI — Jay299792458 · 2026-09-18
- TypeSafe Jev Ecosystem: Six GitHub Projects Spanning Browser Agents and Trading Bots — alexcovo_eth · 2026-09-18