Repository navigation
Description
Link to the code that reproduces this issue
Any Next.js 16.x project with Turbopack (default bundler) on Apple Silicon macOS.
To Reproduce
npx next devon any non-trivial Next.js 16 project on Apple Silicon- Open 2-3 pages in the browser
- Check RSS with
ps aux | grep next-server
Current vs. Expected behavior
Current: next-server process consumes 6-8GB RSS after compiling a few pages. On 8GB machines this causes OOM.
Expected: A dev bundler should not exceed 1-2GB RSS.
Provide environment information
- Next.js: 16.1.7
- Node.js: v22.21.1 / v20.19.0 (same behavior)
- macOS: Darwin 25.3.0 (Apple Silicon M1 Max, 36GB RAM)
- @next/swc-darwin-arm64: 16.1.7
Root Cause Analysis
The 6-8GB is NOT V8 heap — it's IOAccelerator (MAP_JIT) pages
Using vmmap to analyze the next-server process after compiling 2 pages:
Region Type Resident MB (regions)
IOAccelerator 6130 (139) ← THIS IS THE PROBLEM
mapped file 345 (80)
__TEXT 300 (426)
Memory Tag 255 (Rust/mimalloc) 296 (1209)
__OBJC_RO 60 (1)
MALLOC_SMALL 50 (25)
V8's JS heap is only ~300MB (process.memoryUsage().heapUsed). The 6.1GB is in IOAccelerator regions — macOS's label for MAP_JIT mmap pages on Apple Silicon.
IOAccelerator growth correlates with page compilation
| State | RSS | IOAccelerator regions |
|---|---|---|
| SWC binary loaded (no compilation) | 49 MB | 66 (1.4 MB total) |
After compiling / |
2,600 MB | 97 |
After compiling / + /pay |
3,800 MB | 104 |
| After browsing 5+ pages | 6,900 MB | 141 |
Each compiled page adds ~7 IOAccelerator regions that grow from 16KB to 64-128MB each (all rw-/rwx SM=PRV).
Source: Wasmer + Cranelift JIT compiled into SWC binary
The next-swc.darwin-arm64.node binary (100MB) statically links:
- Wasmer 6.1.0-rc3 (337 string references in binary)
- Cranelift code generator (178 references)
wasmer-compiler-cranelift-6.1.0-rc.3swc_plugin_runner-23.0.0
When Turbopack compiles modules, Cranelift JIT-compiles code into MAP_JIT pages. On Apple Silicon, these pages are labeled IOAccelerator by macOS and grow without bound.
experimental.turbopackMemoryLimit is accepted but NEVER used
In crates/next-napi-bindings/src/next_api/turbopack_ctx.rs:
pub fn create_turbo_tasks(
output_path: PathBuf,
persistent_caching: bool,
_memory_limit: usize, // ← PREFIXED WITH UNDERSCORE = UNUSED
dependency_tracking: bool,
is_ci: bool,
is_short_session: bool,
) -> Result<NextTurboTasks> {
// _memory_limit is never referenced in the function bodyThe parameter is passed from JS config but silently ignored. BackendOptions has no memory limit field either.
What we tried (none helped with IOAccelerator)
| Approach | Result |
|---|---|
--max-old-space-size=1024 |
Only limits V8 heap (300MB), no effect on IOAccelerator |
Disable V8 JIT (--no-sparkplug --no-turbofan) |
No change — IOAccelerator is from Cranelift, not V8 |
MIMALLOC_PURGE_DELAY=0 |
Only affects Memory Tag 255 (mimalloc), not IOAccelerator |
RAYON_NUM_THREADS=1 |
No change |
turbopackMemoryLimit: 2GB |
Accepted in config output but ignored (see above) |
turbopackFileSystemCacheForDev: true |
Helps on restart (2.6GB vs 6.8GB cold) but grows back as pages are visited |
Suggested fixes
- Implement the
_memory_limitparameter — it's already wired through from JS config but unused in Rust - Lazy-initialize Wasmer/Cranelift — don't allocate JIT pools unless SWC WASM plugins are actually configured
- Use Singlepass compiler instead of Cranelift for dev mode — single-pass compilation uses dramatically less memory
- Free Cranelift JIT pages after compilation is complete — the compiled WASM code doesn't need to persist in executable memory after the transform is done
- Cap IOAccelerator/MAP_JIT pool size — Cranelift should have a configurable limit on JIT code cache
Which area(s) are affected?
- Turbopack
- Memory usage
- Developer experience on constrained hardware
Which stage(s) are affected?
next dev(Turbopack)
Additional context
The turbopackFileSystemCacheForDev: true experimental flag significantly helps with restart memory (avoids cold recompilation), but doesn't prevent growth during a session as new pages are visited. It should be the default for dev.
This issue affects all Apple Silicon Macs but is most critical on 8GB machines where the 6-8GB RSS causes system OOM. The same IOAccelerator pattern likely occurs on other ARM64 platforms.
Activity
github-actions commentedon Mar 18, 2026
We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.
Why was this issue closed?
To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository (template for App Router, template for Pages Router), but you can also use these templates: CodeSandbox: App Router or CodeSandbox: Pages Router.
The bug template that you filled out has a section called "Link to the code that reproduces this issue", which is where you should provide the link to the reproduction.
What should I do?
Depending on the reason the issue was closed, you can do the following:
In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.
My repository is private and cannot make it public
In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:
I did not open this issue, but it is relevant to me, what can I do to help?
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.
I think my reproduction is good enough, why aren't you looking into it quickly?
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
Useful Resources