Docusaurus leaks memory on i18n site builds #10944
Labels
bug
An error in the Docusaurus core causing instability or issues with its execution
domain: performance
Related to bundle size or perf optimization
When building a Docusaurus site with multiple locales, the memory keeps increasing.
What happens, in pseudo-code:
This can be seen on our website, but also our init template (much smaller leak though).
In #10599 we solved an important leak, but we still leak memory and should investigate so that it's possible to build a Docusaurus site in thousands of locales without having to increase the heap size.
Repro
yarn install yarn clear:website NODE_OPTIONS="--max-old-space-size=250 --expose-gc" DOCUSAURUS_PERF_LOGGER=true yarn build:website:fast --locale en --locale fr --locale ja --locale es
The logs show memory increasing after each locale despite calling
globalThis.gc?.()
before measures.Heap dumps
Heap dumps can be taken after each locale build with little edits in
packages/docusaurus/src/commands/build/build.ts
Access upon request: https://drive.google.com/drive/folders/11JrI_sgw_uwtGBAza52AEyVpiH33Qyq8?usp=sharing
Edit: from this discussion, we can assume that the memory leak grows with the number of MDX docs:
#9211 (reply in thread)
Edit: these articles presents interesting ways to run memory leak tests:
The text was updated successfully, but these errors were encountered: