This is a created article in which the information may have evolved or changed.
- A few days before the interview with a company to get the test questions to use
golang development, during the compilation process occurred a little bit of an episode. On the local mac system can be compiled, when the remote Linux server compile Run go install command, will be error signal: killed . After a few twists and turns, the problem was found to be insufficient memory (at that time my memory is 1G ). Now give me the solution, since it is not enough memory, we can only use the partition on the server swap to solve this problem.
LinuxThe system can allocate partitions when it is installed swap , but many of the servers we buy are pre-installed systems. So we still need to solve this problem in the environment of the system running, so how to partition after the system installation is complete swap ?
To create a file to be a swap partition: increase the 1GB size of the swap partition, the command is written as follows, which count equals the number of blocks (bs*count= file size) you want.
dd if=/dev/zero of=/root/swapfile bs=1M count=1024
format to swap partition file:
mkswap /root/swapfile #建立swap的文件系统
Enable swap partition file:
swapon /root/swapfile #启用swap文件
To make the system self-enabled when booting, add a line to the file/etc/fstab:
/root/swapfile swap swap defaults 0 0