致命错误:疏散分配失败 - 进程内存不足

19

无论我在我的Ubuntu服务器上运行什么,我总是会得到这个错误,有人知道为什么吗?

FATAL ERROR:疏散分配失败 - 进程内存不足

$ node app.js
FATAL ERROR: Evacuation Allocation failed - process out of memory
Aborted (core dumped)

$ npm install
FATAL ERROR: Evacuation Allocation failed - process out of memory
Aborted (core dumped)

$ grunt -grunfile Gruntfile-online.js
FATAL ERROR: Malloced operator new Allocation failed - process out of memory
Aborted (core dumped)

编辑1

$ free
             total       used       free     shared    buffers     cached
Mem:       4194304    2177148    2017156          0          0     936864
-/+ buffers/cache:    1240284    2954020
Swap:      3145728          4    3145724

$ df -h
Filesystem         Size  Used Avail Use% Mounted on
/dev/ploop36057p1  150G  7.6G  137G   6% /
none               2.0G  4.0K  2.0G   1% /dev
none               410M   64K  410M   1% /run
none               5.0M     0  5.0M   0% /run/lock
none               2.0G     0  2.0G   0% /run/shm

编辑2

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  511 mongodb   20   0  879m  30m 7896 S  0.3  0.8  28:37.01 mongod
  689 youtrack  20   0 2034m 671m 6632 S  0.3 16.4  57:36.62 java
28610 my        20   0 17288 1380 1080 R  0.3  0.0   0:00.03 top
    1 root      20   0 24148 1804 1060 S  0.0  0.0   0:05.11 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd/107656
    3 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper/107656
    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/0
    5 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
    6 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/2
    7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/3
    8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/4
    9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/5
   10 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/6
   11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/7
   12 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/8
   13 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/9
   14 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   15 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   16 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   17 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   18 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   19 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   20 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   21 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   22 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   23 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/1
   24 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/2
   25 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/2
   26 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/2
   27 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/107656/2
   28 root      20   0     0    0    0 S  0.0  0.0   0:00.00 nfsiod/107656

@KevinSimper 你好,Kevin,我添加了我的内存信息。 - Fuxian
你尝试过使用--max-old-space-size=64标志运行Node吗?该值以MB为单位,或者通过更改堆栈大小来实现? - krampstudio
你的 Node 版本是多少,你的平台是什么,以及你是如何安装它的? - krampstudio
我忘记了如何安装Node :( - Fuxian
我在Windows上也遇到了同样的错误:https://dev59.com/ro7ea4cB1Zd3GeqPGdQY#34532019 - Cees Timmerman
显示剩余10条评论
1个回答

25

谢谢。这是一篇很棒的文章。但从“free”命令中可以看到,当这个问题发生时,有一个3GB的交换文件,而且它的路径是/dev/null,这让人感到困惑。 - Fuxian

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接