Higher stable memory usage in Webpack 5 on cold start
See original GitHub issueBug report
What is the current behavior?
https://github.com/JoshuaKGoldberg/webpack-5-memory-repro
I set up ☝️ reproduction repository to show a surprising behavior with Webpack 5 compared to Webpack 4: although the peak memory usage is improved on cold start, the stable amount is an extra 50%+ higher.
Webpack 4 memory usage grows towards a peak, then down to a stable amount:
Run | Stable | Peak |
---|---|---|
1 | 1.04 GB | 2.49 GB |
2 | 1.08 GB | 2.29 GB |
3 | 1.07 GB | 2.37 GB |
Webpack 5 memory usage remains stable at roughly its peak:
Run | Stable |
---|---|
1 | 1.65 GB |
2 | 471 MB |
3 | 471 MB |
Is there a memory leak on cold start?
If the current behavior is a bug, please provide the steps to reproduce.
See README.md steps in that repo.
What is the expected behavior?
After whatever cold start logic runs, it should go down to 471 MB.
Sorry if this isn’t the right repository to post this issue; I wasn’t sure given the tool dependencies…
Other relevant information:
webpack version: 5.23.0, comparing to 4.44.1
Node.js version: 12.16.0
Operating System: macOS
Additional tools: webpack-dev-server
: 3.11.2, comparing to 3.9.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top GitHub Comments
@JoshuaKGoldberg Can you measure memory with/without dev server, also I found https://github.com/JoshuaKGoldberg/webpack-5-memory-repro/blob/main/script5/webpack/app.config.js#L2/https://github.com/JoshuaKGoldberg/webpack-5-memory-repro/blob/main/script5/webpack/app.config.js#L3/https://github.com/JoshuaKGoldberg/webpack-5-memory-repro/blob/main/script5/webpack/app.config.js#L7/etc non official plugins, so will be great to measure memory without them (only for testing purposes)
Ah, yeah, I’d hoped to send details privately but it’s looking like this isn’t something we have time to make progress on. Internally we’re moving to Next.js microfrontends instead, each of which have Webpack 5 running quite nicely.
Cheers!