我得到这个错误。有人能给我一个小小的解释吗?我甚至不知道我需要修复什么。
我在编译 typescript 时遇到这个错误。
<--- Last few GCs --->
[1791:0x5533880] 72626 ms: Scavenge (reduce) 2042.8 (2082.2) -> 2042.1 (2082.5) MB, 10.0 / 0.0 ms (average mu = 0.287, current mu = 0.243) allocation failure
[1791:0x5533880] 74247 ms: Mark-sweep (reduce) 2043.0 (2082.5) -> 2037.5 (2082.5) MB, 1617.4 / 0.0 ms (average mu = 0.225, current mu = 0.159) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xb09c10 node::Abort() [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
2: 0xa1c193 node::FatalError(char const*, char const*) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
3: 0xcf8dbe v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
4: 0xcf9137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
5: 0xeb09d5 [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
6: 0xeb14b6 [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
7: 0xebf9de [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
8: 0xec0420 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
9: 0xec339e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
10: 0xe848da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
11: 0x11fd626 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
12: 0x15f2099 [/opt/hostedtoolcache/node/16.15.0/x64/bin/node]
节点. js:16.15.0类型脚本:4.2.4
1条答案
按热度按时间6za6bjd01#
内存消耗量约为2GB,垃圾收集器无法释放任何内存,尽管它非常努力地尝试。一些分配请求需要比剩余可用内存更多的内存,因此崩溃是处理该问题的唯一选择。
解决方案1:使用更少的内存。具体细节取决于您的应用程序:
解决方案2:通过使用
--max-old-space-size=3000
(或大于当前/默认限制的某个其他值;该值以兆字节为单位)。