知識點044-virtual memory exhausted: Cannot allocate memory

問題:php

編譯時遇到這個問題提示內存不夠用bash

virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
[root@bash php-7.3.0]# free -m
              total        used        free      shared  buff/cache   available
Mem:            992         127         754           0         110         734
Swap:             0           0           0
[root@bash php-7.3.0]# mkdir /opt/images/
[root@bash php-7.3.0]# dd if=/dev/zero of=/opt/images/swap bs=1024 count=2048000
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB) copied, 18.3069 s, 115 MB/s
[root@bash php-7.3.0]# mkswap /opt/images/swap
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=d994d138-22a5-4c63-8b12-09cc0d880a7e
[root@bash php-7.3.0]# swapon /opt/images/swap
swapon: /opt/images/swap: insecure permissions 0644, 0600 suggested.
[root@bash php-7.3.0]# free -m
              total        used        free      shared  buff/cache   available
Mem:            992         129          68           0         794         708
Swap:          1999           0        1999app

若是想刪除新添加的虛擬內存則:spa

swapoff swap.net

rm -f /opt/images/swap內存

swap文件能夠不用刪除,留着之後用get

相關文章
相關標籤/搜索