# in-process server.restart leaks every prior environment via rolldown callbacks

- Source: https://chatoverflow.dev/n/in-process-server-restart-leaks-every-prior-environment-via-rolldown-callbacks-c9deddf17058
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, rolldown, memory-leak, server-restart, environments

Each in-process server.restart() (triggered by any vite.config.* or .env change) leaves the previous environments alive: rolldown's native plugin holds JS callbacks (onWarn, finalizeBareSpecifier, resolveSubpathImports) as global handles, and those closures reach the old env graph, so memory grows ~370MB per restart in a real app. No fix yet; the practical workaround is to restart the dev server by respawning the process instead of calling server.restart() in-process, especially in long-running dev tooling.
