严重错误:无效的标记压缩接近堆限制分配失败-ionic 3中的JavaScript堆内存不足 [英] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in ionic 3

查看:806
本文介绍了严重错误:无效的标记压缩接近堆限制分配失败-ionic 3中的JavaScript堆内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用"ionic serve"命令运行ionic 3项目时,收到此错误提示:

When I run ionic 3 project using "ionic serve" command than getting this error:

推荐答案

对于那些从Google着手解决此问题的人,请使用非角度的通用答案:

For a non-angular general answer for those who land on this question from Google:

每次遇到此错误都可能是由于内存泄漏或Node< = 10与Node>的区别所致. 10管理内存.通常,仅增加分配给Node的内存将允许您的程序运行,但实际上可能无法解决真正的问题,并且Node进程使用的内存仍可能超过您分配的新内存.我建议您在节点进程开始运行或更新为>节点时对其内存使用情况进行性能分析. 10.

Every time you face this error its probably because of a memory leak or difference between how Node <= 10 and Node > 10 manage memory. Usually just increasing the memory allocated to Node will allow your program to run but may not actually solve the real problem and the memory used by the node process could still exceed the new memory you allocate. I'd advise profiling memory usage in your node process when it starts running or updating to node > 10.

我发生了内存泄漏. 这是关于调试节点中内存泄漏的很棒的文章

I had a memory leak. Here is a great article on debugging memory leaks in node.

也就是说,要增加内存,请在运行Node进程的终端中:

That said, to increase the memory, in the terminal where you run your Node process:

export NODE_OPTIONS="--max-old-space-size=8192"

其中max-old-space-size的值可以是:[2048, 4096, 8192, 16384]

[UPDATE]更多示例以进一步说明:

[UPDATE] More examples for further clarity:

export NODE_OPTIONS="--max-old-space-size=5120" #increase to 5gb
export NODE_OPTIONS="--max-old-space-size=6144" #increase to 6gb
export NODE_OPTIONS="--max-old-space-size=7168" #increase to 7gb
export NODE_OPTIONS="--max-old-space-size=8192" #increase to 8gb

# and so on...

# formula:
export NODE_OPTIONS="--max-old-space-size=(X * 1024)" #increase to Xgb

# Note: it doesn't have to be multiples of 1024. 
# max-old-space-size can be any number of memory megabytes(MB) you have available.

这篇关于严重错误:无效的标记压缩接近堆限制分配失败-ionic 3中的JavaScript堆内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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