获取GC,在通过webpack捆绑时处理内存不足错误 [英] Getting GC, process out of memory error while bundling via webpack

查看:4321
本文介绍了获取GC,在通过webpack捆绑时处理内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用webpack绑定我的项目时遇到以下错误。
当我只有几个块(分割)点(require.ensure)时,它运行正常,但是当我增加分割点时,出现错误。

 < ---最后几个GC ---> 

124541 ms:标记扫描1379.0(1457.1) - > 1378.9(1457.1)MB,891.6 / 0 ms [分配失败] [请求的旧空间中的GC]。
125398 ms:Mark-sweep 1378.9(1457.1) - > 1378.9(1457.1)MB,857.0 / 0 ms [分配失败] [请求的旧空间中的GC]。
126289 ms:Mark-sweep 1378.9(1457.1) - > 1378.9(1457.1)MB,890.5 / 0 ms [最后的手段gc]。
127136 ms:标记扫描1378.9(1457.1) - > 1378.9(1457.1)MB,847.1 / 0 ms [最后的手段gc]。


<--- JS stacktrace --->

==== JS堆栈跟踪=================================== ======

安全上下文: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<具有映射0x365041d49801的对象)
2:节点[/path/node_modules/babel-traverse/lib/index.js:~119] [pc = 0x126412dd40f5](...

致命错误:CALL_AND_RETRY_LAST分配失败 - 进程内存不足
中止陷阱:6


当我增加节点的大小时,它的工作原理是默认情况下大约为1GB(不确定)

运行节点通过 - max_old_space_size = 4092 增加它的内存,它可以工作

来源:
https://github.com/webpack/webpack/issues/1875#issuecomment-170663572


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

解决方案

This works when I'm increasing size of node, by default it's around 1GB (not sure exact)

Running node by increasing it's memory via --max_old_space_size=4092, it works

Source: https://github.com/webpack/webpack/issues/1875#issuecomment-170663572

这篇关于获取GC,在通过webpack捆绑时处理内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆