Home >Operation and Maintenance >Linux Operation and Maintenance >Solution to insufficient memory in linux
Solution:
Open a swap partition
If Windows has insufficient memory, you can directly open a virtual partition. Linux is similar. When compiling something under Linux, if there is insufficient memory, the program will use the swap partition. We cannot easily change the memory size, but the swap partition is controllable, so we can start here.
Memory View:
We can use the following command to view the usage of memory and Swap partition:
1. Use the hard disk to create
If our hard disk space is enough, then we can use the hard disk to create our partition.
Create a partition file with a size of 2G:
2. Generate a swap file system
3. Activate the swap file
In this way, we can temporarily mount the swap partition. If you want to automatically mount the swap partition when restarting, you can modify /etc/fstab file, add the following content:
#The swap file will be automatically loaded every time the system is restarted.
Recommended tutorial: linux tutorial
The above is the detailed content of Solution to insufficient memory in linux. For more information, please follow other related articles on the PHP Chinese website!