I am using 4 VCPUs - 8GB RAM DigitalOcean VM and running 8 to 10 tomcats on it. I have also created 8 GB Swap Space. However, I always get out of memory (OOM ) error and resulting oom-killer to choose and sacrifice some processes, to free up the memory. And that's why I try the following settings to resolve the OOM Killer's behavior and always check, never overcommit memory by modifying the /etc/sysctl.conf file.

vm.overcommit_memory = 2 vm.overcommit_ratio = 100

As per the above memory allocation formula, 100% Swap Space + 100% RAM should be used by the system.

But now I am not able to start some modules and getting error like "Cannot allocate memory". However, Swap space is more than 50% (4 GB) is free.

I would like to know why memory issue error showing even if enough Swap space is free and how to fix it.

  • Sometime it's not really a matter of available RAM but a matter of available address ranges. Is this a 64-bit OS and 64-bit apps (in your case, this likely means 64-bit JVMs)? – xenoid Apr 29 at 6:59
  • Yes. It's 64-bit system. How to increase address space or what's other alternative? Thanks. – Shiv Apr 29 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.