angular,Last few GCs JavaScript heap out of memory

angular,Last few GCs JavaScript heap out of memory,第1张

angular再运行项目时,出现如下问题:

<--- Last few GCs --->

[4952:000001FA2DC69760]   144757 ms: Mark-sweep 2020.4 (2052.9) -> 2018.8 (2052.9) MB, 1340.9 / 0.1 ms  (average mu = 0.113, current mu = 0.035) allocation failure scavenge might not succeed
[4952:000001FA2DC69760]   146392 ms: Mark-sweep 2020.3 (2052.9) -> 2018.8 (2052.9) MB, 1560.6 / 0.1 ms  (average mu = 0.079, current mu = 0.045) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 00007FF695C8CC5D]
    1: StubFrame [pc: 00007FF695C8DD53]
Security context: 0x02d1675808d1
    2: process(aka process) [000001AAF3DE0D41] [D:\temp\ng13\scrsFrontEnd\node_modules\webpack\lib\serialization\ObjectMiddleware.js:~424] [pc=0000027873688EB4](this=0x01fa2f4c04b1 ,0x00d6ddcd61b1 )
    3: write(aka write) [0000001513662961] [D:\temp\ng13\scrsFrontEnd\node_modules\webpack\lib\s...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF69505285F napi_wrap+119263
 2: 00007FF694FF9526 v8::internal::OrderedHashTable::NextTableOffset+38102
 3: 00007FF694FFA326 node::OnFatalError+438
 4: 00007FF695837AAE v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF69581FC61 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF6956D143C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF6956DC680 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
 8: 00007FF6956D9194 v8::internal::Heap::PageFlagsAreConsistent+3204
 9: 00007FF6956CE993 v8::internal::Heap::CollectGarbage+1283
10: 00007FF6956CD004 v8::internal::Heap::AddRetainedMap+2500
11: 00007FF6956EE34D v8::internal::Factory::NewFillerObject+61
12: 00007FF6954518F1 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1665
13: 00007FF695C8CC5D v8::internal::SetupIsolateDelegate::SetupHeap+546925
14: 00007FF695C8DD53 v8::internal::SetupIsolateDelegate::SetupHeap+551267
15: 0000027873688EB4。

解决方案:

1.打开你的终端(vsCode)或者 Terminal(WebStorm)

2.执行以下命令设置--max_old_space_size值,单位M(8192=8G)

Windows 当前应用程序有效(在vscode或cmd设置,哪里设置的哪里有效,关闭后设置取消,下次需重新在应用程序中设置):

set NODE_OPTIONS=--max_old_space_size=8192

Windows 永久有效(仅用户级别,cmd中运行):

setx NODE_OPTIONS --max-old-space-size=8192

Windows 永久有效(系统级别)

在环境变量窗口中编辑系统级别的环境变量。新增配置:
name: NODE_OPTIONS
value: --max-old-space-size=8192 

我的貌似每次都要在vscode的cmd下运行一下,否则还是会报错:

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1296203.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存