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:

Original post →

More from coding & agent

coding & agent channel →