How Do I Solve the Problem of Swap Exhaustion on a Linux System?

Updated on technology 2024-03-07
5 answers
  1. Anonymous users2024-02-06

    On a Linux system, you can have multiple swaps at the same time, you can see all swaps on the system with the swapon -s command, and you can see the total size of the swap with the free command. Therefore, when the swap is insufficient, you can create another swap, and you can generally create a swap space in the form of a file. The following is an example of how to use a file size to create a memory swap space

    1.Use the dd command to create a 1 GB file in a directory (if you use it to a different directory, the data in the tmp directory will be lost after a restart).

    dd if=/dev/zero of=/tmp/swap bs=1m count=1024

    Explanation: 1m is the unit, 1024 is the number, and the total 1024m is the total size of 1g

    2.Format this file in swap format: (with the mkswap command).

    mkswap /tmp/swap

    3.Start swap and use the swapon command (that is, add the new swap to the system).

    swapon /tmp/swap

    4.See the effect (with the -s parameter of swapon):

    swapon -s

    You can see all the swap partitions, and if it succeeds, the tmp swap must be in it. Then use the free command to check, and you can see that the swap space has increased.

  2. Anonymous users2024-02-05

    Create a swap partition to alleviate the problem of insufficient memory.

  3. Anonymous users2024-02-04

    The only way to get a process to release a swap is to kill the process. Write a script to see which processes are taking up the memory.

    1. Traverse all directories with numbers in the proc directory.

    2. The 1 directory is that the root process restart will cause the system to restart, so it is directly excluded.

    3. Calculate the amount of memory occupied by each process, and then sort by size.

    4. Output processes whose memory usage is greater than 1MB.

    4. Save the running result to a file.

    5. Check that the memory occupation of this process is up to 130 MB.

    6. Kill it directly, and then check it again. OK, swap released a lot at once, and it's done.

  4. Anonymous users2024-02-03

    Method steps.

    When the memory is insufficient when you start the application, go directly to the top of the Linux command line to check it. swap used100%,0free。

    The reboot server can effectively release the swap, but in many cases the server cannot be restarted. At this point, it's important to figure out what's taking up the memory. If you look at the contents of the proc directory, you will find a lot of numbered directories, which are Linux processes.

    The only way to get a process to release a swap is to kill the process. Write a script to see which processes are taking up the memory.

    1. Traverse all directories with numbers in the proc directory.

    2. The 1 directory is that the root process restart will cause the system to restart, so it is directly excluded.

    3. Calculate the amount of memory occupied by each process, and then sort by size.

    4. Output processes whose memory usage is greater than 1MB.

    Save the results of the run to a file.

    Check out that the memory usage of this process is up to 130 MB.

    Kill it directly, and then check it again.

    OK, swap released a lot at once, and it's done.

  5. Anonymous users2024-02-02

    Reboot first, then slowly track the memory usage, if there is a problem, you can see whether it kills or optimizes, and finally decide whether to upgrade.

Related questions
12 answers2024-03-07

We must have an attitude of extreme disapproval and support, family education, the most difficult problem is children's early love. When it comes to early love, there is a strong resonance, and the opinions of parents must be sought, and individual children fall into early love, which does bring a shadow to the school and family, which will affect their studies and cause children to fall into misunderstandings. Parents must understand the characteristics of adolescence, strengthen education, give priority to prevention, and take precautions. >>>More

17 answers2024-03-07

Here's how:

1. Stand-alone windows key, select settings; >>>More

2 answers2024-03-07

If you haven't been able to run auto (orange August, the virus file is, the virus hasn't been run natively, then you can use the method that the guy upstairs said, i.e.: 1Open My Computer, Tools > Folder Options, > View"Hide protected operating system files (recommended)."Remove the tick and ignore the hints. >>>More

29 answers2024-03-07

Fresh ginger is placed under the nose and smelled, or attached to the navel; The orange peel is aimed at the nostrils and squeezed and sucked violently; Wind oil finely coated temples; Rub Neiguan acupoint or Hegu acupoint; Listen to songs with a strong sense of rhythm.

10 answers2024-03-07

The most proud of Apple's mobile phone is that the phone is very smooth, and it can switch between the background and software easily. But as everyone knows, this is already in the past, and many times the Apple mobile phone will still be carded. For example, when switching back to software or games after the end of dialing**, an interface that continues the call will occasionally appear. >>>More