tencent cloud


Triggering Out of Memory When There is Available Memory

Last updated: 2022-04-06 20:30:27

    Error Description

    The Linux CVM does not run out of memory and triggers OOM (Out of Memory) as shown below:

    Possible Reasons

    This issue may be caused by the min_free_kbytes configuration. It specifies the minimum idle memory of the Linux system (in kilobytes). When the system’s available memory goes below the set value of min_free_kbytes, the system will invoke oom-killer or forcibly restart depending on the vm.panic_on_oom kernel parameter:

    • If vm.panic_on_oom=0 is set, the system prompts OOM and invokes oom-killer to kill the process using the most memory.
    • If vm.panic_on_oom =1 is set, the system will restart automatically.


    1. Perform the [troubleshooting procedure] to check the memory utilization and total number of threads.
    2. Correct the min_free_kbytes configuration.

    Troubleshooting Procedure

    1. Check the memory utilization as instructed in High Memory Utilization. If the memory utilization is normal, proceed to the next step.
    2. Check whether the number of threads exceeds the limit as instructed in Log Error “fork: Cannot allocate memory”. If the number of threads is within the limit, proceed to the next step.
    3. Log in to the CVM and run the following command to view the min_free_kbytes configuration.
      sysctl -a | grep min_free

    The min_free_kbytes value is in kbytes. For example, the min_free_kbytes = 1024000 shown below is 1 GB.

    4. Run the following command to open the /etc/sysctl.conf configuration file with VIM editor.

    vim /etc/sysctl.conf
    1. Press i to enter the edit mode and modify the vm.min_free_kbytes configuration item.

      We recommend changing the vm.min_free_kbytes value to no more than 1% of the total memory.

    2. Press Esc, enter :wq, and press Enter to save the configurations and exit the VIM editor.
    3. Run the following command for the configuration to take effect.
      sysctl -p
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support