Getting GC, process out of memory error while bundling

Getting following error when bundling my project with webpack.
When I have only a few chunk (split) points (require.ensure ones) then it runs okay, but when I increase the split points following error comes

<--- Last few GCs --->

  124541 ms: Mark-sweep 1379.0 (1457.1) -> 1378.9 (1457.1) MB, 891.6 / 0 ms [allocation failure] [GC in old space requested].
  125398 ms: Mark-sweep 1378.9 (1457.1) -> 1378.9 (1457.1) MB, 857.0 / 0 ms [allocation failure] [GC in old space requested].
  126289 ms: Mark-sweep 1378.9 (1457.1) -> 1378.9 (1457.1) MB, 890.5 / 0 ms [last resort gc].
  127136 ms: Mark-sweep 1378.9 (1457.1) -> 1378.9 (1457.1) MB, 847.1 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x18342c237339 <JS Object>
    1: get [/path/node_modules/babel-traverse/lib/path/index.js:~75] [pc=0x126413012f98] (this=0x30cb87230cc1 <JS Function NodePath (SharedFunctionInfo 0xa7d7f38b8d9)>,_ref2=0x2b8f0305a311 <an Object with map 0x365041d49801>)
    2: node [/path/node_modules/babel-traverse/lib/index.js:~119] [pc=0x126412dd40f5] (...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6

Author: Fantashit

3 thoughts on “Getting GC, process out of memory error while bundling

  1. @sokra I’m currently using the node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js on all of my projects to not have the GC error.

    I was wondering: would it be possible to add the memory increase as an arg to the Webpack executable?

    I.E: wepack --max-memory 4096

Comments are closed.