Bug Description
codegraph init -i crashes with Fatal process out of memory: Zone during the parsing phase at ~78%. This is not a system-level OOM — the system has plenty of available memory. The crash is a V8 Zone allocator OOM triggered during WebAssembly compilation.
Environment
- CodeGraph version: 0.7.9
- Node.js version: v24.13.0 (via nvm)
- OS: macOS Darwin 25.5.0 (ARM64, Apple Silicon)
- Hardware: Mac Mini, Apple M-series (10 CPUs), 32GB RAM
- Project size: 2,583 files
Memory at Crash Time
- Total system RAM: 32 GB (34,359,738,368 bytes)
- Available memory (free + inactive + speculative): ~17 GB (1,125,561 pages × 16KB page size)
- This is NOT a system OOM — vast memory headroom at the time of the crash.
Stack Trace
The crash trace goes entirely through V8's TurboShaft WASM compilation pipeline:
Fatal process out of memory: Zone
1: node::NodePlatform::GetStackTracePrinter()
2: v8::base::FatalOOM()
3: v8::internal::V8::FatalProcessOutOfMemory()
4: v8::internal::Zone::Expand() ← Zone allocator exhausted
...
10: v8::internal::compiler::turboshaft::Pipeline::Run<WasmLoweringPhase>()
11: v8::internal::compiler::Pipeline::GenerateWasmCode()
12: ExecuteTurboshaftWasmCompilation()
13: wasm::WasmCompilationUnit::ExecuteCompilation()
...
The crash is in WasmLoweringReducer → WasmLoweringPhase → GenerateWasmCode → ExecuteTurboshaftWasmCompilation.
Root Cause Analysis
This crash is consistent with Node.js v24's TurboShaft compiler running out of V8 Zone memory when loading tree-sitter WASM grammars. CodeGraph uses tree-sitter for parsing multiple languages (TypeScript, Python, Go, Rust, Java, etc.), and tree-sitter loads its language parsers as WebAssembly modules. V8's Zone allocator has a limited budget for WASM compilation, and when multiple tree-sitter WASM grammars are loaded simultaneously, the Zone is exhausted.
Key observations:
- The project has 2,583 files spanning many languages (the config includes 20+ language parsers)
- No
.wasm files exist in the project itself — the WASM compilation is from tree-sitter's language parsers
- The existing
.codegraph/codegraph.db was partially built (70.4MB partial index), suggesting parsing gets partway through before the Zone is exhausted
- The crash is reproducible — it happens consistently at ~78% parsing
Possible Solutions
- Reduce Node.js memory pressure for WASM: Allow configuring
--max-old-space-size or similar Node.js flags
- Lazy-load tree-sitter parsers: Only compile WASM grammars when needed, not all at once
- Limit concurrent WASM compilation: Process files in smaller batches
- Document Node.js version compatibility: Node v24's TurboShaft compiler may have a tighter Zone budget than v22 or v20
Workaround Attempted
Cleared .codegraph/ and retried — same reproducible crash at ~78%.
Bug Description
codegraph init -icrashes withFatal process out of memory: Zoneduring the parsing phase at ~78%. This is not a system-level OOM — the system has plenty of available memory. The crash is a V8 Zone allocator OOM triggered during WebAssembly compilation.Environment
Memory at Crash Time
Stack Trace
The crash trace goes entirely through V8's TurboShaft WASM compilation pipeline:
The crash is in
WasmLoweringReducer → WasmLoweringPhase → GenerateWasmCode → ExecuteTurboshaftWasmCompilation.Root Cause Analysis
This crash is consistent with Node.js v24's TurboShaft compiler running out of V8 Zone memory when loading tree-sitter WASM grammars. CodeGraph uses tree-sitter for parsing multiple languages (TypeScript, Python, Go, Rust, Java, etc.), and tree-sitter loads its language parsers as WebAssembly modules. V8's Zone allocator has a limited budget for WASM compilation, and when multiple tree-sitter WASM grammars are loaded simultaneously, the Zone is exhausted.
Key observations:
.wasmfiles exist in the project itself — the WASM compilation is from tree-sitter's language parsers.codegraph/codegraph.dbwas partially built (70.4MB partial index), suggesting parsing gets partway through before the Zone is exhaustedPossible Solutions
--max-old-space-sizeor similar Node.js flagsWorkaround Attempted
Cleared
.codegraph/and retried — same reproducible crash at ~78%.