-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Angular v10 - Excessive memory consumption at build #18087
Comments
This comment has been minimized.
This comment has been minimized.
There was a memory leak in v10 with incremental compilations which we have since tracked down and fixed (see #18034) but yours appears to be a single compilation. As such, I suspect it's a different cause but we'd need more information to be able to investigate. |
Ah yes. Fyi, I use a custom builder to pre-compile |
I can have a look if you are able to share a repo (privately is okay). Otherwise, the easiest way to debug memory issues is to attach a debugger (such as ndb) to get insight into the memory consumption of the processes, from which you can also create heaps dumps. For very large heaps it may be problematic to inspect the dumps, as it takes quite a bit of memory. From a single heap dump it's not always clear whether there's an actual leak (as it's just a single snapshot and spotting leaks may require monitoring over time) but it should already give quite a bit of insight. |
Thanks that's awesome, just invited you to the private repo. Let's follow up the discussion there. |
Thank you, I will have a look later today. |
Alright, I found the culprit., and it was not what I would have ever expected. With the migration to Angular 10, the I applied the patch in webpack-contrib/copy-webpack-plugin#507 locally and it reduces memory usage by 120 times 58 MB, bringing it down to the levels pre-upgrade. Given that there's no Angular 9 is also affected here since #17867 (released 3 weeks ago in CLI 9.1.8), as the upgrade to v6 of |
Transferred to CLI and I attempted to pick some labels here. This is blocked on a release of |
No longer blocked on upstream since a release containing the mentioned fix has been cut. https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v6.0.3 |
That is some very impressive investigation! Thanks a lot for looking into it that fast and solving it. I have quite a bunch of assets indeed, didn't compress / put them in an external bucket yet. I'll report it's working when the fix is released. (Off-topic: Any tip on how I could investigate what seems to be the excessive number of webpack compiles?) |
I am not really familiar with Webpack's compilation model so I can't judge if that number is excessive. If every compilation consumes 60MB of RAM then surely it's a problem, but now that that has been addressed I wouldn't worry about it. |
Those aren't actually excessive compiles. Each component stylesheet currently needs to be processed via a child compilation to allow the full processing pipeline defined within webpack to be used. This is similar to the behavior of the |
Guys, I just updated from 9.1.9 to 10.0.9 and ....
before everything was fine
|
I just upgraded to Angular v10.0.11 in my project where I was using Angular v9.1, I followed the official upgrade guide. I am using docker to build the project for production, and kubernetes to run it in development mode with the development server. In my docker container to build with In Angular v9 it was bad but in v10 it is worse... Could this issue be please reopened? |
Yeah, kinda funny - you said that ng10 was nothing else but a tooling... and now we need an excavator instead of a shovel |
Do you have lots of assets? For me, decreasing the size of assets reduced the memory footprint at build stage. Not really a stable solution though, it's more finger crossing than solving. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Since upgrading to Angular 10, the build process takes an excessive amount of RAM, making it impossible to deploy on Heroku (build fails with OOM error).
For the same code, just upgraded:
Heroku limit is 2.5 Gb, so it fails with Angular 10.
On my local computer, with no such memory limit, the build works ok.
🐞 bug report
Is this a regression?
Yes
Description
The memory spike seems to occur after
ngcc
has finished its pre-compilation stepses2015 to esm2015
and starts actual compilation of the code.Angular Version:
The text was updated successfully, but these errors were encountered: