Home  >  Article  >  Operation and Maintenance  >  Solution to insufficient memory in linux

Solution to insufficient memory in linux

王林
王林Original
2019-11-06 10:41:435588browse

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:

Solution to insufficient memory in linux

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:

Solution to insufficient memory in linux

2. Generate a swap file system

Solution to insufficient memory in linux

3. Activate the swap file

Solution to insufficient memory in linux

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:

Solution to insufficient memory in linux

#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn