linux bash,得到错误的无法分配内存,尽管有足够的内存,为什么?

时间:2017-09-24 13:45:18

标签: linux shell memory operating-system

有时我收到错误-bash: fork: Cannot allocate memory,但是当我运行free -m时,它显示我有足够的内存: total used free shared buffers cached Mem: 128942 107886 21055 0 1037 17665 -/+ buffers/cache: 89183 39758 Swap: 0 0 0

也许它有......与ulimit有关,我运行ulimit -a'结果如下: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 1031505 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 99999 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 1031505 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

此外,lsof |wc -l'结果如下: 14100

我似乎一切都很好,但有时我运行的时候有-bash: fork: Cannot allocate memory,例如top ls du...

1 个答案:

答案 0 :(得分:0)

看起来您的系统交换空间不足。 https://unix.stackexchange.com/questions/41547/linux-running-slow-with-0-swap-left 如果有帮助,请点击竖起大拇指。