Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Lê Vũ Blog
Lê Vũ Blog
  • Trang Chủ
  • Kiến Thức
  • Phần Mềm
  • Du Lịch
  • Mua Sắm
  • Sức Khỏe
  • Ẩm Thực
  • Trang Chủ
  • Kiến Thức
  • Phần Mềm
  • Du Lịch
  • Mua Sắm
  • Sức Khỏe
  • Ẩm Thực
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Kiến ThứcLinux

Error: out of memory

By vuat8b
December 19, 2023 1 Min Read
0

As you might know the system allocates memory on a server by contiguous memory blocks of different size. And there may be a situation where the system does not have contiguous memory blocks of certain size due to memory fragmentation and another service(i.e. VM) requires memory block of that very size. In such situation the service will try using SWAP memory instead of RAM. As a result you can witness a situation where RAM has enough ‘free’ memory but the service will use SWAP instead. And if Swap memory is insufficient the VM can be killed by OOM

For more information about this please refer here:
https://stackoverflow.com/questions/46464785/cannot-allocate-memory-despite-free-reporting-available
https://forum.proxmox.com/threads/memory-allocation-failure.41441/

Here is memory fragmentation explained itself:
https://stackoverflow.com/questions/3770457/what-is-memory-fragmentation

Please, try the below:
To ‘defrag’ the RAM run this command:
echo 1 > /proc/sys/vm/compact_memory

When 1 is written to the file, all zones are compacted such that free memory is available in contiguous blocks where possible.

Then try to tune vm.swappiness in /etc/sysctl.conf:
vm.swappiness = 0

To prevent this issue in the future:
Increase vm.min_free_kbytes in the file /etc/sysctl.d/99-vm.min_free_kbytes.conf
The value should be a multiple of 4096.
You can start at about 5% of total RAM divided by a number of CPU cores.

Author

vuat8b

Follow Me
Other Articles
Previous

mdadm Command Examples in Linux

Next

How to stop VPS migration in SolusVM?

No Comment! Be the first one.

Leave a Reply Cancel reply

You must be logged in to post a comment.

Copyright 2026 — Lê Vũ Blog. All rights reserved. Blogsy WordPress Theme