-
-
Notifications
You must be signed in to change notification settings - Fork 179
Memory usage regression related to uglify between Webpack 2.1 beta to 3.X #188
Comments
Need review latest version on memory leak |
@Phoenixmatrix problem still exists? |
As far as I know it exists on everything at least 2.7 and up all the way to latest(I have not tested all versions between the 2.X-beta and 2.7) I have not tested 4.X alpha as I don't have any app large enough to trigger the issue that will work in 4.X |
|
|
👍
Yep, please report back if this works (better) and include the stack trace / V8 OOM Error in case it still happens |
This is not surprising with such a large code base. Source maps in particular chew up a ton of memory. Your build was likely very close to the node memory limit before and some new code optimizations in more recents versions of webpack and uglify likely pushed it over the limit. It looks like
If you want to isolate uglify memory use just remove the uglify plugin statements from your webpack configs for the two webpack versions and then post the complete unminified webpack produced bundles in a couple of gists so they can be examined. To get faster uglify builds using less memory see: https://github.com/mishoo/UglifyJS2#uglify-fast-minify-mode and disable source maps. |
Yeah, if it didn't go from happening 0% of the time across tens of thousands of builds, to happening 2/3rd time across a dozen different apps (we have hundreds, but only the big ones experienced it, though with consistency), I wouldn't have reported anything. |
@Phoenixmatrix It would be helpful if you could provide peak webpack memory usage and wall clock timings for the following scenarios similar to this issue using Task Manager for Windows or
Use a sufficiently high |
This might be related: mishoo/UglifyJS#2609 |
@andreialecu In mishoo/UglifyJS#2609 you wrote:
This is a different issue. |
Update: I didn't get to run tests yet but will do so this week (holidays are a little crazy). I'm not forgetting about this. |
This shows that |
Ok, that took forever (building our apps takes a bit, and making sure everything lined up properly with Lerna for all the tests was a pain, especially for testing the older webpack version, but I got it right in the end). MethodologyI took one of our above average size apps that had experienced the issue (not the largest ones, because it was taking too long to build to be practical). The only difference between the tests are:
Results
ConclusionThe results are pretty close and within the range of fluctuation that garbage collection can create, so it's not very enlightening. With that said, the uglify version that webpack 3.10 depends on seems to use a bit more memory with uglify + sourcemaps than the older version or the newer version. Enough to explain the random heap allocation errors we would see. Next I'll try putting 1.1.4 in our real production setup and see what happens. |
Thanks for the data. I don't see any problem here. Uglifying code in any configuration for your sources always takes an additional 500 to 600mb of RAM. It's well known that source maps consume a lot of memory. |
Of course. Again, the issue is that moving from webpack 2.1 to 2.7/3.X we saw our memory usage go up enough that we went from 0% failure rate to 50%~ failure rate over heap allocation related crashes in our bigger projects, with everything else (including sourcemaps) being the same. |
As I thought with my comment above:
|
I think this issue can be closed as there's no significant memory regression, and the chart above shows that memory used by |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Using the uglify plugin on a large project (3000-4500 modules) to do a production build seems to have fairly high memory usage and fails with an an heap out of memory error. It's not 100%, but in our projects is fairly easy to repro in all versions I tried, 2.7 all the way to the latest 3.X. In the older 2.1 (beta) version, it never happened over hundreds of builds.
I've tried to narrow down the exact change that causes this but have been unable to do so.
If the current behavior is a bug, please provide the steps to reproduce.
Using a fairly large build (3000+ modules), we're using the following config for the Uglify plugin. Removing it stops the issue from happening as far as I can tell. Sourcemaps enabled are not necessary to repro but make it more frequent:
What is the expected behavior?
So just using
--max_old_space_size=XXXX
fixes the issue and normally I'd just punt on this saying "our build is big, so it's normal", but the fact that it never happened in 2.1 leads me to think there's a regression somewhere.If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Happens in both node 6 LTS and Node 8 LTS, Webpack 2.7 as well as 3.X, MacOS as well as Linux, across several applications (but is related to their size)
This issue was moved from webpack/webpack#6048 by @evilebottnawi. Orginal issue was by @Phoenixmatrix.
The text was updated successfully, but these errors were encountered: