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
- Butterfly traces multi-agent failures with graphs, 62.5% accuracy vs 53.8% for log prompting — JeremyCMorgan · 2026-11-04
- Free course covers the 4 hard problems of production generative media agents — Al_Grigor · 2026-11-04
- Quota reset night: Codex back to 100% while Claude shows just 10% left — rudrank · 2026-11-04
- Self-improving software is inevitable: closing the agent-observability loop — bibryam · 2026-11-04
- Building a 7-GPU 132GB VRAM local inference rig: consolidate on EPYC or split across two systems? — infectiousstupidity · 2026-11-04
- Founder of 50-person, 12-country team says he talks to AI agents more than humans — Scobleizer · 2026-11-04