避免编译代码错误

vps性能很差,会导致虚拟内存不足导致编译错误

virtual memory exhausted: Cannot allocate memory

增加swap分区

$ sudo fallocate -l 1G /swapfile
$ dd if=/dev/zero of=/swapfile bs=2048 count=512k
$ ls -lh /swapfile
$ sudo chown root:root /swapfile
$ sudo chmod 0600 /swapfile
$ ls -lh /swapfile
$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=35699f3a-c408-44a0-9e1e-a646452539ac
$ sudo swapon /swapfile
$ swapon -s
Filename                Type        Size    Used    Priority
/swapfile                               file        1048572    0    -1
$ nano /etc/fstab
/swapfile    none     swap    sw    0 0