-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too much memory usage on build #58902
Comments
Thanks for the report. I have been running the Gutenberg project on WSL2 for over two years, but I have never encountered such an error, nor do I remember operating
How can I test to measure this memory? |
@t-hamano If you do the following, you should be able to see memory usage.
Part of me wonders if this is only an issue on the initial build now considering cache is likely used on each build after. This might not be reproducible without starting fresh. Thanks. |
I performed the following steps.
The average value of the cell where the
|
Yes, that looks correct. I don't ever remember our TypeScript taking that much memory before. Are you using NVM to manage Node? |
I'm currently using volta. |
I'll leave this open in case anyone else has this problem with NVM, but it seems like I might be the only one. So strange. All in all, the Windows filesystem doesn't perform very well with Node so I guess this should come at no shock to anyone. Mac/Linux handles it much better. |
I am using NVM on Debian Trixie and just got an OOM while running This was the last command:
Running |
Yes, I am thinking we should either document this or fix the out of memory error. |
It appears that the memory-consuming area when tsc --build is run is in packages/components.
|
I've also been unable to get past the initial build due to memory errors:
Is there any work around? The suggested npm run clean:package-types doesn't resolve this. |
I suspect this is related to some types that are very costly to process. @mirka has landed some work on it here: #63388 I haven't seen the memory issues myself recently, but a common fix is to increase the amount of memory Node.js can use. That can be handled by an environment variable. On UNIX machines, this would would be an example of how to do that: NODE_OPTIONS='--max-old-space-size=8000' npm run build:packages |
Good suggestion @sirreal I found this similar command (have not tried it yet) |
Not sure if this helps but when I'm running build it's stopping with an error about |
That directory should be generated during build, but it may not be if an error occurs before. |
Commit: 154f1aa, command is
|
That looks like a standard out of memory error. The Ideally the build would take less memory, but there's still work to be done there 🙂 |
Raising memory didn't work for me, but I've probably only got about 7000 available. Maybe later I'll throw it on a server and see if it can build there. |
Many of the people reporting issues here seem to be using Windows OS. I'd love to know if the memory exhaustion is happening on the host OS or on WSL (Ubuntu). By default, WSL has 50% of the memory that the host OS has: https://learn.microsoft.com/en-us/windows/wsl/wsl-config#main-wsl-settings Therefore, I think we need to check the following:
|
This issue is ongoing, there was another report today: https://wordpress.slack.com/archives/C5UNMSU4R/p1728225107128589 |
I also did a build on a 2G memory VPS and it failed, NODE_OPTIONS='--max-old-space-size=8000' had no effect on 2G. OS: Ubuntu 22.04.2 LTS |
The build went well with a combination of swap memory (7GB) and 2GB memory. OS: Ubuntu 22.04.2 LTS `top - 13:52:54 up 19 days, 16:09, 2 users, load average: 4.42, 4.29, 2.57 top - 14:16:57 up 19 days, 16:33, 2 users, load average: 5.12, 4.24, 4.11 |
Description
I spun up my new WSL VM this afternoon and discovered the
npm run build
script is using an insane amount of memory. I received a Node out of memory heap error and had to increase using this environment variable.export NODE_OPTIONS=--max_old_space_size=6000
It looks like at peak build, it nearly uses 3GB of memory which is absolutely insane. It fails right at the TypeScript build.
Step-by-step reproduction instructions
npm i && npm run build
.Screenshots, screen recording, code snippet
No response
Environment info
N/A.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: