webpack-contrib / webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
MIT License
12.53k stars 479 forks source link

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #543

Closed VivienZhai closed 1 year ago

VivienZhai commented 1 year ago

Issue description

I use webpack-bundle-analyzer when I build angular production version. It generates stats.json which is 752459 kb。 Then I start running stats.json, it throws the error " JavaScript heap out of memory". Is there any way to increase running memory, like node's '--max_old_space_size=***'?

Technical info

  ng build --prod --stats-json
  webpack-bundle-analyzer dist/console/stats.json 

Error info

Security context: 0x0283582c08d1 <JSObject>
    0: builtin exit frame: parse(this=0x0283582dee79 <Object map = 000003C23B783639>,0x02922af80119 <Very long string[796105331]>,0x0283582dee79 <Object map = 000003C23B783639>)

    1: readStatsFromFile [0000022E07B0CE11] [D:\WorkSpace\***\node_modules\webpack-bundle-analyzer\lib\analyzer.js:179] [bytecode=0000002DF5A93731 offset=36](this=0x013e19b80991 <Object map = 000000F1194343...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
valscion commented 1 year ago

I think this might be a duplicate of https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/492 but the error you're seeing is different, although the reason why it fails sounds like the same reason to me.

valscion commented 1 year ago

I suppose this has been resolved now by https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/423. Feel free to try v4.8.0 and let us know if your issue wasn't resolved.