我在React组件上使用玩笑和快照运行测试脚本,并收到以下错误。
由于任何原因,我也无法使用CLI命令更新快照。
<---后几个GC --->
3401 ms: Mark-sweep 1113.1 (1170.3) -> 806.9 (857.2) MB, 7.1 / 0.0 ms (+ 91.4 ms in 2 steps since start of marking, biggest step 70.1 ms) [allocation failure] [GC in old space requested].
3859 ms: Mark-sweep 1339.2 (1389.4) -> 587.4 (640.3) MB, 99.7 / 0.0 ms [allocation failure] [GC in old space requested].
3974 ms: Mark-sweep 587.4 (640.3) -> 580.0 (635.3) MB, 115.1 / 0.0 ms [allocation failure] [GC in old space requested].
<--- JS堆栈跟踪--->
==== JS堆栈跟踪======================================== =
安全上下文:0x328898ccfb51 2:分页(aka分页)[pc = 0xf7a30cd8c77](this = 0x328898c04381,_ref = 0x3f401f211b81) 3:参数适配器框架:3-> 1 4:/ *匿名 /(又名/ 匿名* /)...
致命错误:无效的数组长度分配失败-JavaScript堆 内存不足1:node :: Abort() [/Users/xxxx/.nvm/versions/node/v6.9.2/bin/node] 2: node :: FatalException(v8 :: Isolate *,v8 :: Local, v8 :: Local) [/Users/xxxx/.nvm/versions/node/v6.9.2/bin/node] 3: v8 :: internal :: V8 :: FatalProcessOutOfMemory(char const *,bool) [/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 4: v8 :: internal :: Heap :: AllocateUninitializedFixedArray(int) [/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 5: v8 :: internal :: Factory :: NewUninitializedFixedArray(int) [/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 6: v8 :: internal ::((匿名 名称空间):: ElementsAccessorBase
:: ConvertElementsWithCapacity(v8 :: internal :: Handle, v8 :: internal :: Handle, v8 :: internal :: ElementsKind,unsigned int,unsigned int,unsigned int, int)[/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 7: v8 :: internal ::((匿名 名称空间):: ElementsAccessorBase :: GrowCapacityAndConvertImpl(v8 :: internal :: Handle, unsigned int)[/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 8: v8 :: internal :: Runtime_GrowArrayElements(int,v8 :: internal :: Object **, v8 :: internal :: Isolate *) [/Users/xxx/.nvm/versions/node/v6.9.2/bin/node] 9:0xf7a307079a7✨ 完成于5.29秒。
答案 0 :(得分:0)
您要遍历某些东西还是创建大量大型数组实例? JS堆不是无限的。听起来好像发生了内存泄漏,或者您试图构建的阵列太大了。