Repository navigation
Description
Link to the code that reproduces this issue
To Reproduce
- Clone the repo and
bun install(ornpm install) bun dev(ornpx next dev)- Run
vmmap $(pgrep -f next-server) | grep "^IOAccelerator"— observe 2.0 GB allocated before opening any page - Visit http://localhost:3099/chat/test
- Re-run vmmap — IOAccelerator has grown to 3.5 GB
- Wait 2+ minutes, re-run vmmap — nothing is freed
Current vs. Expected behavior
Current: The @next/swc-darwin-arm64 native binary allocates IOAccelerator (MAP_JIT) memory
regions during Turbopack compilation that grow monotonically and are never freed. A 5-page app
with standard SaaS dependencies reaches 3.5 GB of permanent IOAccelerator allocations. A
production app with 27 pages reaches 13.9 GB.
Expected: Compilation artifacts should be freed after compilation completes, or at minimum
be bounded by a configurable limit.
The SWC binary is the source (isolated with controls):
| Process | IOAccelerator |
|---|---|
| Bare Node.js | 0 MB |
| Node.js + require(next-swc.node) | 136 MB + 896 MB reserved |
| Next.js dev (after compiling 5 pages) | 3,500 MB |
Not runtime-specific: Tested with both Node.js and Bun — identical results.
Never freed: After compilation completes, IOAccelerator regions persist for the lifetime of
the process. Tested with 120+ seconds idle — zero bytes reclaimed.
Invisible to Node.js tools: process.memoryUsage() doesn't report it. --max-old-space-size
doesn't limit it. experimental.turbopackMemoryLimit is accepted in config but not wired to the
native binary.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.0.0
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.19.0
npm: 10.9.3
Yarn: 1.22.22
pnpm: 10.17.0
Relevant Packages:
next: 16.2.1
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack, SWC, Performance
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Related issues:
- Turbopack dev: 6-8GB RSS on Apple Silicon caused by Wasmer/Cranelift JIT (IOAccelerator MAP_JIT pages) #91585 — previous report (closed for insufficient reproduction)
- macOS Apple Silicon: memory invisible to RSS — bmalloc slabs, worker cleanup gaps, GC safety bugs oven-sh/bun#28318 — same 128 MB slab pattern in Bun/JSC
- IOAccelerator GPU memory leak: idle sessions accumulate ~1 GB non-reclaimable footprint each anthropics/claude-code#35804 — same pattern in Bun + Ink
On Apple Silicon, IOAccelerator memory competes with GPU, media engine, and system processes
for the same unified physical RAM. A developer running next dev on a 16 GB MacBook with a
moderately-sized app can lose 8-14 GB to non-reclaimable allocations they can't see, control,
or limit.
Activity
tjb9dc commentedon Apr 10, 2026
Seeing this same thing on Next.js 16.1.1 with a larger but not very big app (56 pages, 58 API routes).
If helpful:
Setup:
Measurements after navigating several pages:
footprintoutput:process.memoryUsage()(via inspector) with the same process:{"heapUsed":"578MB","heapTotal":"619MB","rss":"4698MB","external":"5MB","arrayBuffers":"1MB"}4.1GB gap between RSS and V8 heap, almost entirely IOAccelerator. Confirmed
next-swc.darwin-arm64.nodeis the only native addon loaded.pastarita commentedon Apr 11, 2026
Confirming this at production scale — 769 routes (522 page + 247 API) in a TurboRepo monorepo with 259 transpilePackages. This is the same IOAccelerator pattern at a much larger route count.
Environment
next dev)transpilePackages, 228 workspace packages, 164outputFileTracingExcludesKey Findings
1. Version bisect — bug predates Next.js 16
All versions show identical pattern: ~1.1GB plateau for 20-30s, then explosion to 4GB+ in 2-4 seconds.
2. Webpack mode is WORSE, not better
Same IOAccelerator pattern under
next dev --no-turbo:This means the leak is in shared Next.js infrastructure (route discovery, file watching, module resolution), not Turbopack-specific code. The issue title mentioning Turbopack may cause people to think switching to webpack is a workaround — it is not.
3. Route count is the trigger, not config complexity
Full
next.config.ts(259 transpilePackages, 164 excludes, 53 optimizePackageImports, 18 serverExternalPackages) works perfectly with 1 route. The same config with 769 routes triggers OOM.4. Node 22 makes the leak lethal (Node 20 survives)
Same IOAccelerator leak in both versions, but Node 20 pages it to disk while Node 22 maps it as resident. The leak is the same; Node 22 just makes it fatal sooner on constrained machines.
5. Memory category isolation
Via
footprintcommand at 4GB RSS:V8 profiling tools,
--max-old-space-size, and native heap profilers are all blind to this — the leak is entirely in IOAccelerator.6. Growth pattern is consistent
The Phase 3→4 transition at ~45s is the critical event. Something completes or triggers after ~25s of compilation that causes unbounded IOAccelerator allocation.
Hypothesis
CoreServices file operations on Apple Silicon M4 allocate IOAccelerator (GPU-accessible unified memory) for internal buffers. During route discovery/compilation, Next.js performs 43,000+ file stat/watch operations. These buffers accumulate without being freed.
next-swc.darwin-arm64.nodelinks CoreFoundation + CoreServices (which handle file I/O on macOS) but does NOT link Metal or IOKit directly — IOAccelerator allocation must come through a transitive path via CoreServices.Impact — Total Blocker
This is a completely blocking issue for us. No page route compiles on the 16GB M4 Mac Mini — zero. Not a slow build, not degraded performance — the dev server is entirely unusable for page development. API routes work,
next buildcompletes in 79 seconds, production deploys fine. Onlynext devwith page routes is broken.We've been unable to do any frontend page development on this machine for days. The only workaround we've found is a "bench" tool we built that renames route directories with
_prefix (Next.js private folder convention) to reduce the active route count below ~200, but this means 73% of our routes are inaccessible during development.This will affect any team running a monorepo with 200+ page routes on a 16GB Apple Silicon Mac — which is the most common developer machine Apple sells.
Tooling
We built a memory watchdog that auto-polls RSS, captures
vmmap/footprintat 1GB/2GB/3GB thresholds, and auto-kills at 4GB. Happy to share artifacts from 4 captured runs across Next.js 15.5-16.2.lukesandberg commentedon Apr 12, 2026
This IOAccelerator memory is just memory allocated by the native binary (which is why it is not visible to node.js tools). As we compile routes we cache information about those routes in memory which is why memory goes up as more routes.
| Just loading the SWC binary — before compiling anything — allocates 136 MB and reserves 896 MB more.
yeah this is expected, this is approximately how big the binary is and then we also initialize the native heap
(also, the
turbopackMemoryLimitfeature is indeed unimplemented and will likely be removed in a future release)Since the concern is about the oomkiller, tracking memory via vmmap is somewhat misleading. When processes map files into ram they get accounted to vmmap but not necessarily to 'physical heap' which is the thing the OOM killer cares about.
The better metric to track is RSS or Physical Footprint
vmmap -summary $(pgrep -f next-server) | grep "Physical footprint"or just RSS as reported by
psps -o pid,rss,vsz -p $(pgrep -f next-server)Since that is what the OOM killer cares about
From that i can see that RSS does go down over time, in my case it is due to heap compression and swapping
So killing the server at 4G of allocated IOAccellerator pages is the problem, in all scenarios i see that number only going up over the course of dev server sessions. (this is the behavior of our memory allocator which maps anonymous memory and tags it as droppable instead of returning it) But this isn't the important number, systems have lots of virtual memory address space and you shouldn't care about it. So your watchdog should only care about RSS/Physical footprint (aka working set memory)
That being said I am are currently working on a few solutions to decrease our 'working set size' in conjunction with our filesystem caching solution.
isaacwasserman commentedon Apr 12, 2026
The RSS is misleading as well. These numbers are simply heuristics. The real problem is memory pressure; after compiling a single page on the dev server, MacOS activity monitor claims that next is using >12GB of memory. There's no way that's intentional.
mketiku commentedon May 23, 2026
Additional reproduction — Next.js 16.2.6, Apple Silicon, 128 routes
Environment
page.tsx+ 56route.ts= 128 total@sentry/nextjs10.52.0,@supabase/supabase-js2.105.3,posthog-js1.372.10Observed behaviour
After a normal dev session (~100–200 page compilations via HMR),
next-serverreaches 9.04 GB RSS in Activity Monitor. Memory grows monotonically and does not reclaim between page navigations or during idle periods.V8 vs native breakdown
To isolate how much of this is V8 vs native, I took a heap snapshot via
kill -USR1 <pid>and the Chrome DevTools Protocol:process.memoryUsage()and not captured in the snapshotRunning
vmmap <pid> | grep "^IOAccelerator"confirms the gap is IOAccelerator allocations, consistent with this report.Confirmed non-fixes
NODE_OPTIONS=--max-old-space-size=4096— no effect on the balloonexperimental.turbopackMemoryLimit— accepted by config, produces no observable change (as noted in the original report — not wired to the native binary)Scale correlation
The 128-route count fits the pattern reported here (3.5 GB for 5 pages, 13.9 GB for 27 pages) — larger apps hit the ceiling faster. On a 16 GB machine this competes directly with Docker, Chrome, and other dev tooling, quickly pushing into swap.
The only mitigation found is periodic
next devrestarts. Happy to provide additional heap data or run specific diagnostics if useful.fix(dev): use --webpack for int-tests frontend to avoid turbopack idl…
perf(frontend): auto-select Turbopack for dev on Linux, webpack on ma…
joeyorlando commentedon Jun 11, 2026
@lukesandberg is there any fix planned for this in the next version? 🙏
without this it basically makes next.js local development unusable on Apple Silicon (insanely slow / eats up all resources on an M5 Macbook Pro) 🙁
lukesandberg commentedon Jun 11, 2026
@joeyorlando The most recent next canary releases have a new feature enabled
turbopackMemoryEvictionwhich should help by offloading data to disk when idle. This is still under development but should be a win for your test scenario.deps(frontend): upgrade next to 16.3.0-preview.3 (#5514)
ljrahn commentedon Jun 17, 2026
16.3.0-preview.3 very much helped free up memory on my apple silicon. i was completely unable to develop on my 16gb machine before because next was taking +10gb and when im running with docker, my laptop just completely freezes up. with this, next is stable around ~1.5-2gb, and doesnt keep growing.
chore(dev): default Tilt local dev to Turbopack for the Next dev serv…
chore(frontend): default local dev to the turbopack bundler (archestr…
serban4 commentedon Jul 20, 2026
Additional data point: 52 GB phys_footprint (peak 58 GB) after a ~13 h dev
session — Next.js 16.2.6, Apple Silicon
Adding this because it is substantially larger than the numbers reported so
far and suggests growth is effectively unbounded with session length rather
than only scaling with route count (~105 routes here, similar to earlier
reports that saw ~12 GB).
Environment
next dev --turbopack), pnpmnext devran ~13 h with an AI coding agent driving many incrementalrebuilds (147 min cumulative CPU on
next-server)Measurements
Details consistent with @lukesandberg's explanation (native-binary
allocations, not actual GPU work):
sampleshows zero active Metal/IOAcceleratorstack frames — Metal frameworks are only transitively loaded.
next-swc.darwin-arm64.node.psRSS showed ~2 GB while the real footprint was 52 GB (26×underestimate) — nearly all of it compressed/swapped, so it silently
exhausted swap and the system-wide compressor before anyone noticed.
processes on the same machine sit at ~75 MB footprint.
Haven't tested
turbopackMemoryEvictionfrom the 16.3 canaries in thisproject yet — will report back once it reaches stable. Happy to provide more
diagnostics if useful.
chore(deps): upgrade next 16.1.7 -> 16.3.0 (#96)
flexi767 commentedon Aug 9, 2026
Independent confirmation on the current 16.2 stable line, plus a controlled production-mode comparison.
Environment
page.tsx+ 335route.tssource entriesReal application
next devprocess reached 9.8 GB physical footprint after compiling the locale root.IOAcceleratorplus app-specific tag 16.psRSS was much smaller thanfootprint, consistent with the compressed/swapped behavior discussed above.next startmeasured 248 MB footprint after an HTTP 200 render of the same application.--max-old-space-sizecannot constrain this native allocation.Minimal one-page control
A temporary one-page, force-dynamic App Router app using the same installed Next/React packages was driven with bounded HTTP requests and sampled using macOS
footprint:next devnext startThis also confirms that the application database, image pipeline, and route code are not required for the dev/production gap, while route count and session length amplify it substantially.
Our operational mitigation is now: production-mode server for browser QA, serialize browser suites across worktrees, stop idle worktree servers, and restart managed dev servers at a physical-footprint threshold. The full app's production-mode result is stable in the hundreds of MB; production deployments are not showing the dev-server growth.
I have not yet tested
turbopackMemoryEvictionon 16.3 preview/canary.marcoshernanz commentedon Aug 31, 2026
Thanks for the detailed repro. Turbopack memory eviction shipped in Next.js 16.3 and is enabled by default. Reports here and in #81161 show the working set now settles instead of growing without bound, so I’m closing this as fixed. If high physical footprint still reproduces on the latest 16.3 release, please open a new issue with fresh
footprintoutput and a minimal repro.github-actions commentedon Aug 31, 2026
This issue was closed by a maintainer. If you think it was closed by mistake, you can request that it be reopened within the next 14 days.
Reply with
Reopen: <reason>and explain why the issue is still relevant. If you opened this issue or commented before it was closed, the issue will be reopened automatically.After 14 days, please open a new issue with up-to-date details and a reproduction, when applicable.
github-actions commentedon Sep 15, 2026
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.