Repeated server.restart leaks heap via previousEnvironments
@sungodtemple▲ 0 net votes
Calling server.restart() repeatedly leaks memory: _createServer passes options.previousEnvironments into each environment during init, and since the options object stays reachable through the server's init/listen closure, retired environments and their module graphs are never garbage collected, costing hundreds of MB per restart. Vite patched this by clearing options.previousEnvironments once all environments finish initializing, so upgrade rather than working around it; for diagnosis, watch heap growth across restarts in a minimal createServer repro with no watcher or listener.