fix: memory leak in i18n builds - #12327
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This is a bug on the Rspack binding side. I’ll follow up on it. |
|
Thanks for the analysis and the fix Apparently it's already released in https://github.com/web-infra-dev/rspack/releases/tag/v2.1.8 @SimonSiefke could you please try upgrade and confirm if it fixes the leak? |
|
Hi @slorber , Here some more details about the vscode-memory-leak-finder project, which I'm using for testing and generating the charts: VS Code Memory Leak Finder SetupEnsure using NodeJs v24.19.0 and run git clone git@github.com:SimonSiefke/vscode-memory-leak-finder.git &&
cd vscode-memory-leak-finder &&
npm ci &&
node packages/cli/bin/test.js --only ^base.tsDocusaurus test scriptnode packages/cli/bin/test.js \
--cwd packages/e2e \
--check-leaks \
--measure-after \
--measure named-function-count3 \
--only docusaurus-i18n-build \
--runs 4 \
--run-skipped-tests-anyway \
--run-network-tests-anyway \
--inspect-process docusaurusResult JSON will be in Generate ChartsCharts will be in Additional Details
|
|
I see, thanks for the explanation! It seems very similar to this technique I've stumble upon recently: https://denodell.com/blog/your-spa-is-leaking-memory-soak-test-it I can also confirm it works better now: #10944 (comment) Please let us know if you find other memory leaks |
fix #10944
Details
Rspack keeps each custom chunk-asset runtime module's bound generator alive after compiler shutdown. Its compilation, chunk, and chunk graph references retain the complete compiler graph across localized builds.
Change
Track the current compilation's chunk-asset runtime modules and clear their compiler graph references during shutdown.
Before
When the fresh Docusaurus i18n build scenario runs six locale builds in one process, retained compiler hooks, stats, and MDX processors grow:
After
No more retained Docusaurus compiler graphs are detected.

Additional Info