问题:
编译时遇到这个问题提示内存不够用
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 1999
如果想删除新添加的虚拟内存则:
swapoff swap
rm -f /opt/images/swap
swap文件可以不用删除,留着以后用
来源:oschina
链接:https://my.oschina.net/u/3635512/blog/3010070