-
Notifications
You must be signed in to change notification settings - Fork 155
build-optimizer: high memory usage (node crash) #240
Comments
Hi @MrBlaise, does this happen on a project I could look at? In the context of angular/angular-cli#5618, I expect Build Optimizer usage to always use some memory, but It's odd that it happens at the 95% stage since most of the work Build Optimizer does is before the 90% phase. Regardless, in angular/angular-cli#5618 (comment) I also have a report of high memory usage that I can't really reproduce, and in angular/angular-cli#5618 (comment) I have a report of very long times for build optimizer. If your project isn't available, would you be interested in following some debug steps? |
Hi @filipesilva ! Unfortunately I can't share the project because it is private but I am more than happy to help with the debugging steps If I can. |
That's great to hear! I think it can be one of two things: either a transform is taking up a lot of memory, or the purify plugin has a runaway regex. Lets measure how much memory some runs take. Make a new npm scrip that runs the CLI with increased memory allowance:
This number should be enough but increase it if you need to. If you're on a mac the easiest way to see peak memory usage is to use
The number you want is Then do the same with Testing purify is easiest. Go to I think one of the build optimizer transformations is using up a lot of memory on your codebase, but I can't know which ones. I can tell you how to disable each one individually though. You can do this in If you can do this for each one and time me how it impacts memory used, I might be able to figure out which of the transforms is using up a lot of memory. |
Here are my tests @filipesilva . I don't know it it is helpful, I don't see much difference with all the options :/ Testing purify enabled or disabled:purify ENABLED purify ENABLED Testing build-optimizer transformations (
|
This issue was moved to angular/angular-cli#12159 |
Bug Report or Feature Request (mark with an
x
)Area
Versions
macOS 10.13 (High Sierra)
It affects Windows as well, but on mac it is higher (larger than 1.7 gigs, therefore causes crash with node by default)
Repro steps
The problem is happening with the build-optimizer version
0.0.31
.Using @angular/cli
1.5.0-rc.2
and building withng build --prod --aot --build-optimizer
The memory usage starts to grow radically at
95% emitting
stage. On a semi-large project this reaches 1.7 gigs on mac, which in turn causes a crash. Increasing the memory limit on node solves the issue, but this seems rather high.Running it without build-optimizer it builds fine without a crash.
The log given by the failure
Desired functionality
Using the build-optimizer shouldn't exceed the default 1.7GB threshold on a semi-large project.
The text was updated successfully, but these errors were encountered: